Browse Source

数据查看账户数据同比计算修改

yangzian 4 năm trước cách đây
mục cha
commit
5d336c1c61

+ 3 - 1
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/report/mapper/BytedanceAdvertiserHourlyReportMapper.java

@@ -25,6 +25,8 @@ public interface BytedanceAdvertiserHourlyReportMapper extends BaseMapper<Byteda
     List<ReportCostVo> selectPlanCostInfoCount(@Param("accountId") String accountId, @Param("planId") String planId, @Param("startTime") String startTime, @Param("endTime") String endTime);
     //账户 时报
     List<ReportCostVo> getReportCostInfoStage(@Param("accountId") String accountId, @Param("startTime") String startTime, @Param("endTime") String endTime);
+    //查询上阶段 同时间点的 日报 数据信息
+    List<ReportCostVo> getReportCostInfoStageLast(@Param("accountId") String accountId, @Param("startTime") String startTime, @Param("endTime") String endTime,@Param("statHour") String statHour);
 
     Map<String,Object> selAcountIdCostMax(@Param("userId") String userId, @Param("type") String type);
 
@@ -34,7 +36,7 @@ public interface BytedanceAdvertiserHourlyReportMapper extends BaseMapper<Byteda
     List<ReportCostVo> selectReportPlanCostInfoDay(@Param("accountId") String accountId, @Param("planId") String planId, @Param("startTime") String startTime, @Param("endTime") String endTime);
     //计划 时报
     List<ReportCostVo> selectReportPlanCostInfo(@Param("accountId") String accountId, @Param("planId") String planId, @Param("startTime") String startTime, @Param("endTime") String endTime);
-    ////查询上阶段 同时间点的 时报 数据信息
+    //查询上阶段 同时间点的 日报 数据信息
     List<ReportCostVo> selectReportPlanCostHourLast(@Param("accountId") String accountId,@Param("planId") String planId,@Param("startTime") String startTime, @Param("endTime") String endTime,@Param("statHour") Integer statHour);
 
 }

+ 26 - 1
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/report/mapper/xml/BytedanceAdvertiserHourlyReportMapper.xml

@@ -31,7 +31,7 @@
 
     </select>
 
-    <!-- 阶段 查询  账户时报数据信息 -->
+    <!-- 查询  账户时报 数据信息 -->
     <select id="getReportCostInfoStage" resultType="org.jeecg.modules.bytedance.report.entity.vo.ReportCostVo">
         SELECT
             id,
@@ -55,6 +55,31 @@
             stat_hour
     </select>
 
+    <!-- 查询  账户时报  时间点截至 数据信息 -->
+    <select id="getReportCostInfoStageLast" resultType="org.jeecg.modules.bytedance.report.entity.vo.ReportCostVo">
+        SELECT
+            id,
+            SUM(cost) AS cost,
+            SUM(show_num) AS showNum,
+            SUM(click) AS click,
+            SUM(convert_num) AS convertNum,
+            stat_datetime,
+            stat_hour AS time,
+            create_time
+        FROM
+            ctop_bytedance_report_advertiser_hourly
+        WHERE
+            advertiser_id = #{accountId}
+            AND stat_datetime &gt;= #{startTime}
+            AND stat_datetime &lt;= #{endTime}
+            AND stat_hour &lt;= #{statHour}
+        GROUP BY
+            stat_hour
+        ORDER BY
+            stat_datetime,
+            stat_hour
+    </select>
+
 <!-- 查询用户下 花费最高的 账户-->
     <select id="selAcountIdCostMax" resultType="java.util.HashMap">
         SELECT

+ 3 - 1
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/report/service/impl/BytedanceAdvertiserHourlyReportServiceImpl.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import com.sun.xml.bind.v2.TODO;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.bytedance.advertise.entity.AiBytedanceAdvertiserStrategy;
 import org.jeecg.modules.bytedance.advertise.entity.ByteDanceAdvertisePlan;
@@ -90,8 +91,9 @@ public class BytedanceAdvertiserHourlyReportServiceImpl extends ServiceImpl<Byte
         }else{
             // 账户 当前时间段数据
             nowCostList = bytedanceAdvertiserHourlyReportMapper.getReportCostInfoStage(accountId,startTime,endTime);
+            ReportCostVo statHourVo = nowCostList.get(nowCostList.size()-1);
             //上阶段数据
-            lastCostList = bytedanceAdvertiserHourlyReportMapper.getReportCostInfoStage(accountId,lastTimeMap.get("lastTimeStart"),lastTimeMap.get("lastTimeEnd"));
+            lastCostList = bytedanceAdvertiserHourlyReportMapper.getReportCostInfoStageLast(accountId,lastTimeMap.get("lastTimeStart"),lastTimeMap.get("lastTimeEnd"),statHourVo.getTime());
         }
 
         //更新时间