Browse Source

快手、头条账户视频报表更换application库数据

zhaoxian 3 năm trước cách đây
mục cha
commit
8dd21af28c

+ 2 - 2
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/controller/BytedanceAccountReportCtrl.java

@@ -98,7 +98,7 @@ public class BytedanceAccountReportCtrl {
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
         try {
-            List<JSONObject> listData = bytedanceAccountReportService.getListDataBy(mediaId, discount, accounts, startDate, endDate, hour, target, order);
+            List<JSONObject> listData = bytedanceAccountReportService.getListDataBy(mediaId, accounts, startDate, endDate, hour, target, order);
             result.setResult(listData);
             result.setSuccess(true);
         } catch (Exception e) {
@@ -141,7 +141,7 @@ public class BytedanceAccountReportCtrl {
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
         int hour = requestBody.getInteger("hour");
-        List<JSONObject> excelData = bytedanceAccountReportService.getExcelDataBy(filed, mediaId, accounts, startDate, endDate, hour, target, order);
+        List<JSONObject> excelData = bytedanceAccountReportService.getListDataBy(filed, accounts, startDate, endDate, hour, target, order);
         if (excelData.isEmpty()) {
             return;
         }

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/mapper/xml/BytedanceAccountReportMapper.xml

@@ -106,7 +106,7 @@
         ${filed}
         FROM application.bytedance_advertiser_report_hourly_dw  t1
         WHERE t1.stat_datetime &lt;=DATE_FORMAT(#{endDate},'%Y%m%d')
-        AND t1.stat_datetime &gt;= DATE_FORMAT(#{statDate},'%Y%m%d')
+        AND t1.stat_datetime &gt;= DATE_FORMAT(#{startDate},'%Y%m%d')
         AND t1.account_id in
         <foreach item="item" index="index" collection="accountIds"
                  open="(" separator="," close=")">

+ 4 - 4
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/service/IBytedanceAccountReportService.java

@@ -13,13 +13,13 @@ import java.util.Map;
 
 public interface IBytedanceAccountReportService {
 
-    Map<String,Object> getSumDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate , String endDate);
+    Map<String, Object> getSumDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate);
 
-    List<JSONObject> getChartDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate , String endDate) throws ParseException;
+    List<JSONObject> getChartDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate) throws ParseException;
 
-    List<JSONObject> getListDataBy(String mediaId,BigDecimal discount, JSONArray accounts,String startDate ,String endDate, int hour, String target, String order);
+    List<JSONObject> getListDataBy(String mediaId, JSONArray accounts, String startDate, String endDate, int hour, String target, String order);
 
-    List<JSONObject> getExcelDataBy(String filed, String mediaId, JSONArray accounts,String startDate ,String endDate, int hour, String target, String order);
+    List<JSONObject> getExcelDataBy(String filed, String mediaId, JSONArray accounts, String startDate, String endDate, int hour, String target, String order);
 
     PageInfo<ByteDanceReportAccountDailyDTO> getBytedanceAccountInfoByProjectId(String startDate, String endDate, Long projectId, Integer pageNo, Integer pageSize, String sort, Integer yn);
 

+ 6 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/BytedanceAccountReportServiceImpl.java

@@ -99,7 +99,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
     }
 
     @Override
-    public List<JSONObject> getListDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
+    public List<JSONObject> getListDataBy(String mediaId, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
         List<JSONObject> result;
         String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDictMapBy());
         filedAll = filedAll.replace("like_num", "`like`").
@@ -129,14 +129,18 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
             if (startDate.equals(DateUtils.date2Str())) {
                 result = bytedanceAccountReportMapper.queryTodaySumByHourGroupAccount(filedAll, startDate, hour, accounts, target, order);
                 JSONObject afterSum = bytedanceAccountReportMapper.querySumByHour(filedAll, startDate, hour, accounts);
+                afterSum.put("authName", "总计");
                 JSONObject beforeSum = bytedanceAccountReportMapper.querySumByHour(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), hour, accounts);
+                beforeSum.put("authName", "昨日总计(相对)");
                 result.add(afterSum);
                 result.add(beforeSum);
                 result.add(countTotal(afterSum, beforeSum));
             } else {
                 result = bytedanceAccountReportMapper.querySumByDateGroupAccount(filedAll, endDate, startDate, accounts, target, order);
                 JSONObject afterSum = bytedanceAccountReportMapper.queryAllSumByStartEndDate(filedAll, endDate, startDate, accounts);
+                afterSum.put("authName", "总计");
                 JSONObject beforeSum = bytedanceAccountReportMapper.queryAllSumByStartEndDate(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, endDate, -1), DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), accounts);
+                beforeSum.put("authName", "昨日总计(相对)");
                 result.add(afterSum);
                 result.add(beforeSum);
                 result.add(countTotal(afterSum, beforeSum));
@@ -237,6 +241,7 @@ public class BytedanceAccountReportServiceImpl implements IBytedanceAccountRepor
                 jsonObject.put(k, (LinkUtils.countLink(after.getBigDecimal(k) == null ? zero : after.getBigDecimal(k), before.getBigDecimal(k) == null ? zero : before.getBigDecimal(k))).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP) + "%");
             }
         });
+        jsonObject.put("authName", "环比");
         return jsonObject;
     }
 

+ 3 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/common/constant/AccountReportConstants.java

@@ -53,7 +53,7 @@ public class AccountReportConstants {
             "    \"comment\": \"安卓开始下载数\"\n" +
             "  },\n" +
             "  \"downloadStartCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.cost) / (t1.download_start) IS NULL THEN 0 ELSE sum(t1.cost) / sum(t1.download_start) end AS downloadStartCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / (t1.download_start) IS NULL THEN 0 ELSE ROUND(sum(t1.cost) / sum(t1.download_start),3) end AS downloadStartCost \",\n" +
             "    \"comment\": \"安卓开始下载成本\"\n" +
             "  },\n" +
             "  \"downloadStartRate\": {\n" +
@@ -65,7 +65,7 @@ public class AccountReportConstants {
             "    \"comment\": \"安卓下载完成数\"\n" +
             "  },\n" +
             "  \"downloadFinishCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.download_finish) IS NULL THEN 0 ELSE  sum(t1.cost) / sum(t1.download_finish) end AS downloadFinishCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.download_finish) IS NULL THEN 0 ELSE  ROUND(sum(t1.cost) / sum(t1.download_finish),3) end AS downloadFinishCost \",\n" +
             "    \"comment\": \"安卓下载完成成本\"\n" +
             "  },\n" +
             "  \"downloadFinishRate\": {\n" +
@@ -77,7 +77,7 @@ public class AccountReportConstants {
             "    \"comment\": \"激活数\"\n" +
             "  },\n" +
             "  \"activeCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.active) IS NULL THEN 0 ELSE sum(t1.cost) / sum(t1.active) end AS activeCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.active) IS NULL THEN 0 ELSE ROUND(sum(t1.cost) / sum(t1.active),3) end AS activeCost \",\n" +
             "    \"comment\": \"激活成本\"\n" +
             "  },\n" +
             "  \"activeRate\": {\n" +