Forráskód Böngészése

账户维度-联调优化bug修复

zhaoxian 4 éve
szülő
commit
0831d5ec43
15 módosított fájl, 77 hozzáadás és 20 törlés
  1. 30 0
      module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAccountAudienceReportEtlJob.java
  2. 6 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java
  3. 2 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/EtlKuaishouReportAccountHourlyController.java
  4. 1 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaiShouGroupDailyReportMapper.java
  5. 2 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaiShouAccountMaterialOverviewMapper.xml
  6. 12 2
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaiShouGroupDailyReportMapper.xml
  7. 3 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouVideoEtlInfoMapper.xml
  8. 2 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaiShouGroupDailyReportService.java
  9. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaishouReportAccountHourlyService.java
  10. 5 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaiShouGroupDailyReportServiceImpl.java
  11. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaiShouNewlyServiceImpl.java
  12. 3 3
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouAudienceAccountDailyServiceImpl.java
  13. 4 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouReportAccountHourlyServiceImpl.java
  14. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouAudienceReportDailyAccountServiceImpl.java
  15. 4 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/ByteDanceVideoReportDailyController.java

+ 30 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAccountAudienceReportEtlJob.java

@@ -0,0 +1,30 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouAudienceAccountDailyService;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouReportAccountDailyService;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 清洗盯盘人群——年龄、性别数据
+ *
+ * @author syh
+ */
+@Component
+public class KuaishouAccountAudienceReportEtlJob {
+
+    @Autowired
+    private IEtlKuaishouAudienceAccountDailyService etlKuaishouAudienceAccountDailyService;
+
+    @XxlJob("kuaishouAccountAudienceReportEtlJob")
+    public void execute() throws Exception {
+        try {
+            etlKuaishouAudienceAccountDailyService.queryEveryDayAudienceInfo();
+            XxlJobHelper.log("queryEveryDayAudienceInfo success");
+        } catch (Exception e) {
+            XxlJobHelper.log(e.getMessage());
+        }
+    }
+}

+ 6 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/controller/BatchController.java

@@ -16,6 +16,7 @@ import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouCampaignMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouTargetingTagsMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.*;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaiShouGroupDailyReportService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -875,6 +876,8 @@ public class BatchController {
         return result;
     }
 
+    @Autowired
+    private IEtlKuaiShouGroupDailyReportService shouGroupDailyReportService;
 
     /**
      * 批量修改广告组状态
@@ -913,6 +916,9 @@ public class BatchController {
                                     failJson.put("campaignName", group.getUnitName());
                                 }
                                 failArr.add(failJson);
+                            } else {
+                                //更新数据状态
+                                shouGroupDailyReportService.updateStatus(accountId,unitId,putStatus);
                             }
                         }
                     }

+ 2 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/EtlKuaishouReportAccountHourlyController.java

@@ -106,9 +106,9 @@ public class EtlKuaishouReportAccountHourlyController {
     @AutoLog(value = "获取当日花费最大的账户")
     @ApiOperation(value = "获取当日花费最大的账户", notes = "获取当日花费最大的账户")
     @GetMapping(value = "/getMaxChargeAccountId")
-    public Result<Object> getMaxChargeAccountId(Long accountId) {
+    public Result<Object> getMaxChargeAccountId(Long accountId,String userId) {
         try {
-            return etlKuaishouReportAccountHourlyService.getMaxChargeAccountId(accountId);
+            return etlKuaishouReportAccountHourlyService.getMaxChargeAccountId(accountId,userId);
         } catch (Exception e) {
             log.error("查询异常,", e.getMessage());
             e.printStackTrace();

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/EtlKuaiShouGroupDailyReportMapper.java

@@ -22,4 +22,5 @@ public interface EtlKuaiShouGroupDailyReportMapper extends BaseMapper<EtlKuaiSho
 
     List<JSONObject> queryPageList(@Param("accountId") Long accountId, @Param("sortCode") String sortCode, @Param("sortType") String sortType);
 
+    void updateStatus(@Param("accountId")  Long accountId,@Param("unitId")  Long unitId, @Param("putStatus") Integer putStatus);
 }

+ 2 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaiShouAccountMaterialOverviewMapper.xml

@@ -64,7 +64,8 @@
         newly_use_count as newlyUseCount,
         total_count as totalCount,
         effective_count as effectiveCount,
-        hot_money_count as hotMoneyCount
+        hot_money_count as hotMoneyCount,
+        update_time as updateTime
         from  ctop_etl_kuaishou_account_material_overview
         where account_id = #{accountId}
         and state_date = #{statDate}

+ 12 - 2
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaiShouGroupDailyReportMapper.xml

@@ -68,7 +68,7 @@
 
     <select id="queryPageList" resultType="com.alibaba.fastjson.JSONObject">
         SELECT
-        unit_id as 'unitId',
+        t1.unit_id as 'unitId',
         account_id as 'accountId',
         unit_name as 'unitName',
         t1.charge,
@@ -77,7 +77,8 @@
         bid_type as 'bidType',
         unit_status as 'unitStatus',
         activation,
-        ROUND((t1.charge-t2.charge)/t2.charge*100,2) 'grew'
+        ROUND((t1.charge-t2.charge)/t2.charge*100,2) 'grew',
+        t1.update_time as 'updateTime'
         FROM ctop_etl_kuaishou_group_daily_report t1
         LEFT JOIN (
         SELECT charge,unit_id FROM ctop_etl_kuaishou_group_daily_report
@@ -103,4 +104,13 @@
         ${sortType}
     </select>
 
+    <update id="updateStatus">
+        update
+            ctop_etl_kuaishou_group_daily_report
+        set unit_status = #{putStatus}
+        where account_id = #{accountId}
+          and unit_id = #{unitId}
+          and stat_date = DATE_FORMAT(now(), '%Y-%m-%d')
+    </update>
+
 </mapper>

+ 3 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouVideoEtlInfoMapper.xml

@@ -20,8 +20,8 @@
         SELECT t1.signature,
                t1.charge as 'charge',
                t1.activation as 'activation',
-               t1.photo_show as 'phototShow',
-               ROUND(t1.charge / t1.activation, 2) as 'activationCost',
+               t1.photo_show as 'photoShow',
+               IFNULL(ROUND(t1.charge / t1.activation, 2),0) as 'activationCost',
                t2.url,
                t2.cover_url as 'coverUrl',
                t2.state_date as 'stateDate'
@@ -36,7 +36,7 @@
         <if test="sortCode == 'activationCost' ">
             ORDER BY t1.charge / t1.activation
         </if>
-        <if test="sortCode == 'phototShow' ">
+        <if test="sortCode == 'photoShow' ">
             ORDER BY t1.photo_show
         </if>
         <if test="sortCode == 'activation' ">

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaiShouGroupDailyReportService.java

@@ -19,4 +19,6 @@ public interface IEtlKuaiShouGroupDailyReportService extends IService<EtlKuaiSho
     void getGroupReport(Long accountId, String accessToken, String startDate, String endDate, Integer page);
 
     Result<Object> queryPageList(JSONObject request);
+
+    void updateStatus(Long accountId, Long unitId, Integer putStatus);
 }

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/IEtlKuaishouReportAccountHourlyService.java

@@ -22,5 +22,5 @@ public interface IEtlKuaishouReportAccountHourlyService extends IService<EtlKuai
 
     Result<Object> getEtlReportList(JSONObject request);
 
-    Result<Object> getMaxChargeAccountId(Long accountId);
+    Result<Object> getMaxChargeAccountId(Long accountId, String userId);
 }

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaiShouGroupDailyReportServiceImpl.java

@@ -100,6 +100,11 @@ public class EtlKuaiShouGroupDailyReportServiceImpl extends ServiceImpl<EtlKuaiS
         return Result.ok(pageInfo);
     }
 
+    @Override
+    public void updateStatus(Long accountId, Long unitId, Integer putStatus) {
+        groupDailyReportMapper.updateStatus(accountId,unitId,putStatus);
+    }
+
     /**
      * 数据清洗
      *

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaiShouNewlyServiceImpl.java

@@ -117,7 +117,7 @@ public class EtlKuaiShouNewlyServiceImpl extends ServiceImpl<EtlKuaiShouNewlyMap
     public Result<Object> getNewlyCounts(Long accountId) {
         List<Object> list = kuaiShouNewlyMapper.getNewlyCounts(accountId);
         if (Check.isNull(list)) {
-            return Result.error("未查询到数据");
+            return Result.ok("未查询到数据");
         }
         return Result.ok(list);
     }

+ 3 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouAudienceAccountDailyServiceImpl.java

@@ -58,7 +58,7 @@ public class EtlKuaishouAudienceAccountDailyServiceImpl extends ServiceImpl<EtlK
             list = accountDailyMapper.queryEveryDayInfo(value, type, accountId, audienceType, parType);
         }
         if (Check.isNull(list)) {
-            return Result.error("未查询到数据");
+            return Result.ok("未查询到数据");
         }
         return Result.ok(list);
     }
@@ -85,7 +85,7 @@ public class EtlKuaishouAudienceAccountDailyServiceImpl extends ServiceImpl<EtlK
             list = accountDailyMapper.queryEveryDayInfo(value, type, accountId, audienceType, parType);
         }
         if (Check.isNull(list)) {
-            return Result.error("未查询到数据");
+            return Result.ok("未查询到数据");
         }
         return Result.ok(list);
     }
@@ -110,7 +110,7 @@ public class EtlKuaishouAudienceAccountDailyServiceImpl extends ServiceImpl<EtlK
             list = accountDailyMapper.getSceneEveryDayInfo(value, accountId, parType);
         }
         if (Check.isNull(list)) {
-            return Result.error("未查询到数据");
+            return Result.ok("未查询到数据");
         }
         return Result.ok(list);
     }

+ 4 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/EtlKuaishouReportAccountHourlyServiceImpl.java

@@ -73,7 +73,7 @@ public class EtlKuaishouReportAccountHourlyServiceImpl extends ServiceImpl<EtlKu
         String endTime = request.getString("endTime");
         EtlKuaishouReportAccountHourly today = null;
         EtlKuaishouReportAccountHourly yesterday = null;
-        if (Check.isNull(endTime)) {
+        if (endTime.equals(startTime)) {
             Integer hour = DateUtils.getHour(DateUtils.now());
             today = etlHourlyAccountMapper.getOnedayAggregateByHour(startTime, accountId, hour);
             String lastDay = DateUtils.getLastDay(startTime, 1);
@@ -120,7 +120,7 @@ public class EtlKuaishouReportAccountHourlyServiceImpl extends ServiceImpl<EtlKu
         JSONObject obj = new JSONObject();
         List<JSONObject> todayList = null;
         List<JSONObject> yesterdayList = null;
-        if (Check.isNull(endTime)) {
+        if (endTime.equals(startTime)) {
             todayList = etlHourlyAccountMapper.getOnedayEtlReportList(startTime, accountId, value, type);
             String lastDay = DateUtils.getLastDay(startTime, 1);
             yesterdayList = etlHourlyAccountMapper.getOnedayEtlReportList(lastDay, accountId, value, type);
@@ -137,10 +137,9 @@ public class EtlKuaishouReportAccountHourlyServiceImpl extends ServiceImpl<EtlKu
     }
 
     @Override
-    public Result<Object> getMaxChargeAccountId(Long accountId) {
+    public Result<Object> getMaxChargeAccountId(Long accountId, String userId) {
         if (Check.isNull(accountId)) {
-            LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-            accountId = etlDailyAccountMapper.getMaxChargeAccountId(sysUser.getId());
+            accountId = etlDailyAccountMapper.getMaxChargeAccountId(userId);
         }
         JSONObject obj = new JSONObject();
         CtopOauthToken oauthToken = oauthTokenService.getTokenByAccountId(accountId);

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouAudienceReportDailyAccountServiceImpl.java

@@ -82,7 +82,7 @@ public class KuaishouAudienceReportDailyAccountServiceImpl extends ServiceImpl<K
             data.put("businessInterestTags", bussiness);
         }
         if (data.size() == 0) {
-            return Result.error("未查询到数据");
+            return Result.ok("未查询到数据");
         }
         return Result.ok(data);
     }

+ 4 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/controller/ByteDanceVideoReportDailyController.java

@@ -264,8 +264,11 @@ public class ByteDanceVideoReportDailyController {
             if (Check.isNull(accountId) || Check.isNull(columnType)) {
                 return Result.error("请选择账户和类型");
             }
+            Result<Object> result = new Result();
             String json = videoReportDailyService.getColumnJsonByAccountId(accountId, columnType);
-            return Result.ok(json);
+            result.setResult(json);
+            result.setSuccess(true);
+            return result;
         } catch (Exception e) {
             e.printStackTrace();
             return Result.error("查询异常," + e.getMessage());