Bläddra i källkod

数据查看添加更新时间

yangzian 4 år sedan
förälder
incheckning
6203f70345

+ 1 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/report/entity/vo/ReportCostVo.java

@@ -50,6 +50,7 @@ public class ReportCostVo implements Serializable {
     //环比
     private String compare;
 
+    private String createTime;
     private String updateTime;
 
     //操作状态

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

@@ -14,7 +14,8 @@
             convert_num,
             stat_hour,
             stat_datetime,
-            stat_hour AS time
+            stat_hour AS time,
+            create_time
         FROM
             ctop_bytedance_report_advertiser_hourly
         WHERE
@@ -40,7 +41,8 @@
             SUM(convert_num) AS convertNum,
             SUM(stat_hour) AS statHour,
             stat_datetime,
-            stat_datetime AS time
+            stat_datetime AS time,
+            create_time
         FROM
             ctop_bytedance_report_advertiser_hourly
         WHERE
@@ -58,7 +60,8 @@
         SELECT
             cah.advertiser_id AS accountId,
             SUM( cah.cost ) cost,
-            cua.auth_name AS authName
+            cua.auth_name AS authName,
+            cah.create_time
         FROM
             ctop_bytedance_report_advertiser_hourly cah
         LEFT JOIN ctop_user_allocation cua ON cah.advertiser_id = cua.account_id
@@ -104,6 +107,7 @@
         sum(cost) AS cost,
         ad_id,
         ad_name,
+        create_time,
         update_time
         FROM
         ctop_bytedance_report_plan_hourly

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

@@ -76,6 +76,11 @@ public class BytedanceAdvertiserHourlyReportServiceImpl extends ServiceImpl<Byte
 
         //当前时间段数据
         nowCostList = bytedanceAdvertiserHourlyReportMapper.getReportCostInfo(accountId,startTime,endTime);
+
+        //更新时间
+        List<ReportCostVo> updTimeList = nowCostList.stream().sorted(Comparator.comparing(ReportCostVo::getCreateTime)).collect(Collectors.toList());
+        resultMap.put("updTime",Check.isNull(updTimeList) ? new Date() : updTimeList.get(0).getCreateTime());
+
         //当前阶段 总花费
         double nowCost = nowCostList.stream().mapToDouble(ReportCostVo::getCost).sum();
         resultMap.put("nowCost", String.format("%.2f", nowCost));
@@ -90,7 +95,8 @@ public class BytedanceAdvertiserHourlyReportServiceImpl extends ServiceImpl<Byte
 
         //环比 =(当前花费 - 上阶段花费 )/ 上阶段花费
         compare = (nowCost - lastCost) / lastCost;
-        resultMap.put("compare", Double.isNaN(compare) ? "0" : df.format(compare));
+        //resultMap.put("compare", Double.isNaN(compare) ? "0" : df.format(compare));
+        resultMap.put("compare", Double.isNaN(compare) ? "0" : String.format("%.2f", compare*100));
 
         //花费占比 = 花费 / 账户预算
         //获取账户预算
@@ -126,6 +132,8 @@ public class BytedanceAdvertiserHourlyReportServiceImpl extends ServiceImpl<Byte
 
         resultMap.put("nowMap", nowMap);
         resultMap.put("lastMap", lastMap);
+
+
         return Result.successMsg("成功。",resultMap);
     }