Browse Source

盯盘2.0功能 更改盯盘时数据和日数据一致

zhaoxian 4 years ago
parent
commit
050a39326f

+ 4 - 1
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouDailyAccountReportLoadEtlJob.java

@@ -3,6 +3,7 @@ package cn.com.ctop.job.kuaishou.handler;
 import cn.com.ctop.kuaishou.modules.report.mapper.EtlKuaishouAccountMaterialReportDailyMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouAccountMaterialReportDailyService;
 import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouReportAccountDailyService;
+import cn.com.ctop.kuaishou.modules.report.service.IEtlKuaishouReportAccountHourlyService;
 import com.xxl.job.core.context.XxlJobHelper;
 import com.xxl.job.core.handler.annotation.XxlJob;
 import org.jeecg.common.util.DateUtils;
@@ -26,11 +27,13 @@ public class KuaishouDailyAccountReportLoadEtlJob {
     private IEtlKuaishouAccountMaterialReportDailyService etlKuaishouAccountMaterialReportDailyService;
     @Resource
     private EtlKuaishouAccountMaterialReportDailyMapper etlKuaishouAccountMaterialReportDailyMapper;
-
+    @Autowired
+    private IEtlKuaishouReportAccountHourlyService hourlyService;
     @XxlJob("kuaishouDailyAccountReportLoadEtl")
     public void execute() throws Exception {
         try {
             iEtlKuaishouReportAccountDailyService.queryEveryDayDataForAccount();
+            hourlyService.updateYesterdayEtlHourlyData();
             XxlJobHelper.log("queryEveryDayDataForAccount success");
         } catch (Exception e) {
             XxlJobHelper.log(e.getMessage());

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

@@ -45,4 +45,6 @@ public interface EtlKuaishouReportAccountDailyMapper extends BaseMapper<EtlKuais
     List<JSONObject> leaderAccountPageList(JSONObject request);
 
     int leaderAccountPageListTotal(JSONObject request);
+
+    List<EtlKuaishouReportAccountHourly> selectList(@Param("startDate") String startDate,@Param("endDate") String endDate);
 }

+ 7 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouReportAccountDailyMapper.xml

@@ -553,4 +553,11 @@
     </select>
 
 
+    <select id="selectList" resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly">
+        SELECT * from ctop_etl_kuaishou_report_account_daily
+        WHERE stat_date &gt;= #{startDate}
+        and stat_date &lt;= #{endDate}
+    </select>
+
+
 </mapper>

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

@@ -39,4 +39,6 @@ public interface IEtlKuaishouReportAccountHourlyService extends IService<EtlKuai
     Result<Object> projectList(JSONObject request) throws Exception;
 
     Result<Object> leaderAccountPageList(JSONObject request) throws Exception;
+
+    void updateYesterdayEtlHourlyData();
 }

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

@@ -86,6 +86,19 @@ public class EtlKuaishouReportAccountHourlyServiceImpl extends ServiceImpl<EtlKu
     }
 
     @Override
+    public void updateYesterdayEtlHourlyData() {
+        //昨天日期
+        String lastStartDate = DateUtils.getLastDay(DateUtils.formatDate(new Date()), 1);
+        List<EtlKuaishouReportAccountHourly> list = etlDailyAccountMapper.selectList(lastStartDate, lastStartDate);
+        if (!Check.isNull(list)) {
+            for (EtlKuaishouReportAccountHourly accountHourly : list) {
+                accountHourly.setStatHour(23l);
+            }
+            etlHourlyAccountMapper.replaceBatch(list);
+        }
+    }
+
+    @Override
     public Result<Object> getAggregateByHour(JSONObject request) throws ParseException {
         Long accountId = request.getLong("accountId");
         String startTime = request.getString("startTime");