5 Commits abefa1cf2f ... 853e237f8c

Author SHA1 Message Date
  songyh 853e237f8c 修改gateway配置 3 years ago
  songyh fde914e03b Merge branch 'master-report' 3 years ago
  songyh d6af29f3c1 修改自定义列sql拼接问题 3 years ago
  songyh 8b3f6b6827 修改sql查询逻辑bug 3 years ago
  songyh 3124a74c91 修改sql查询逻辑bug 3 years ago
23 changed files with 214 additions and 187 deletions
  1. 54 57
      jeecg-boot-report/src/main/java/cn/com/ctop/common/constant/AccountReportConstants.java
  2. 1 1
      jeecg-boot-report/src/main/java/cn/com/ctop/common/mapper/xml/ProjectMapper.xml
  3. 29 28
      jeecg-boot-report/src/main/java/cn/com/ctop/common/mapper/xml/ProjectMemberMapper.xml
  4. 1 1
      jeecg-boot-report/src/main/java/cn/com/ctop/common/mapper/xml/SysDepartMapper.xml
  5. 5 5
      jeecg-boot-report/src/main/java/cn/com/ctop/common/mapper/xml/SysRoleMapper.xml
  6. 1 1
      jeecg-boot-report/src/main/java/cn/com/ctop/common/mapper/xml/SysUserMapper.xml
  7. 3 3
      jeecg-boot-report/src/main/java/cn/com/ctop/common/mapper/xml/UserAllocationMapper.xml
  8. 10 5
      jeecg-boot-report/src/main/java/cn/com/ctop/report/controller/KuaishouAccountReportDailyDwController.java
  9. 4 4
      jeecg-boot-report/src/main/java/cn/com/ctop/report/controller/KuaishouMaterialReportDailyDwController.java
  10. 5 1
      jeecg-boot-report/src/main/java/cn/com/ctop/report/entity/AccountAttributionInfo.java
  11. 6 6
      jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/AccountAttributionInfoMapper.java
  12. 1 1
      jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/KuaishouAccountReportDailyDwMapper.java
  13. 1 1
      jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/KuaishouAccountReportHourlyDwMapper.java
  14. 1 1
      jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/KuaishouMaterialVideoReportDailyDwMapper.java
  15. 20 19
      jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/xml/AccountAttributionInfoMapper.xml
  16. 3 3
      jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/xml/KuaishouAccountReportDailyDwMapper.xml
  17. 22 25
      jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/xml/KuaishouMaterialVideoReportDailyDwMapper.xml
  18. 21 11
      jeecg-boot-report/src/main/java/cn/com/ctop/report/service/impl/AccountAttributionInfoServiceImpl.java
  19. 15 9
      jeecg-boot-report/src/main/java/cn/com/ctop/report/service/impl/KuaishouAccountReportDailyDwServiceImpl.java
  20. 3 3
      jeecg-boot-report/src/main/resources/application-dev.yml
  21. 1 1
      jeecg-boot-report/src/main/resources/application-prod.yml
  22. 1 1
      jeecg-cloud-module/jeecg-cloud-gateway/src/main/resources/application-dev.yml
  23. 6 0
      jeecg-cloud-module/jeecg-cloud-gateway/src/main/resources/application-prod.yml

+ 54 - 57
jeecg-boot-report/src/main/java/cn/com/ctop/common/constant/AccountReportConstants.java

@@ -16,11 +16,11 @@ public class AccountReportConstants {
             "    \"comment\": \"消耗\"\n" +
             "  },\n" +
             "  \"showMaterial\": {\n" +
-            "    \"filed\": \"IFNULL(sum(t1.show_num),0) as showMaterial \",\n" +
+            "    \"filed\": \"IFNULL(sum(t1.`show`),0) as showMaterial \",\n" +
             "    \"comment\": \"展示数\"\n" +
             "  },\n" +
             "  \"cpm\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.show_num) IS NULL THEN 0 ELSE ROUND((sum(t1.cost) / sum(t1.show_num)) * 1000, 2 ) END AS cpm \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.`show`) IS NULL THEN 0 ELSE ROUND((sum(t1.cost) / sum(t1.`show`)) * 1000, 2 ) END AS cpm \",\n" +
             "    \"comment\": \"平均千次展现费用\"\n" +
             "  },\n" +
             "  \"clickMaterial\": {\n" +
@@ -28,7 +28,7 @@ public class AccountReportConstants {
             "    \"comment\": \"点击数\"\n" +
             "  },\n" +
             "  \"ctr\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.show_num) != 0 THEN concat(CAST(round( sum(t1.click) /sum(t1.show_num)*100,2) AS CHAR),'%') ELSE '0%' end as ctr \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.`show`) != 0 THEN concat(CAST(round( sum(t1.click) /sum(t1.`show`)*100,2) AS CHAR),'%') ELSE '0%' end as ctr \",\n" +
             "    \"comment\": \"点击率\"\n" +
             "  },\n" +
             "  \"cpc\": {\n" +
@@ -158,7 +158,7 @@ public class AccountReportConstants {
             "    \"comment\": \"消耗\"\n" +
             "  },\n" +
             "  \"photoShow\": {\n" +
-            "    \"filed\": \"IFNULL(sum(show),0) as photoShow \",\n" +
+            "    \"filed\": \"IFNULL(sum(`show`),0) as photoShow \",\n" +
             "    \"comment\": \"封面曝光数\"\n" +
             "  },\n" +
             "  \"photoClick\": {\n" +
@@ -174,23 +174,23 @@ public class AccountReportConstants {
             "    \"comment\": \"行为数\"\n" +
             "  },\n" +
             "  \"clickRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(show) != 0    THEN CONCAT( CAST(ROUND((sum(photo_click) / sum(show)) * 100,2) AS CHAR) ,'%') else 0 END AS clickRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(`show`) != 0  THEN ROUND(sum(photo_click)/sum(`show`)*100,2)  else 0 END AS clickRate \",\n" +
             "    \"comment\": \"封面点击率\"\n" +
             "  },\n" +
             "  \"bClickRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(aclick) != 0 THEN CONCAT( CAST(ROUND((sum(bclick) / sum(aclick)) * 100,2) AS CHAR) ,'%') ELSE '0%' END AS bClickRate \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(aclick) != 0 THEN ROUND(sum(bclick)/sum(aclick) * 100,2) ELSE 0 END AS bClickRate \",\n" +
             "    \"comment\": \"行为率\"\n" +
             "  },\n" +
             "  \"cpm\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(show) IS NULL THEN 0 ELSE ROUND((sum(charge) / sum(show)) * 1000, 2 ) END AS cpm \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge)/sum(`show`) IS NULL THEN 0 ELSE ROUND(sum(charge)/sum(`show`)*1000, 3 ) END AS cpm \",\n" +
             "    \"comment\": \"平均千次封面曝光花费\"\n" +
             "  },\n" +
             "  \"cpc\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(photo_click) IS NULL THEN 0 ELSE ROUND((sum(charge) / sum(photo_click)), 2) END AS cpc \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge)/sum(photo_click) IS NULL THEN 0 ELSE ROUND((sum(charge) / sum(photo_click)), 3) END AS cpc \",\n" +
             "    \"comment\": \"平均封面点击单价\"\n" +
             "  },\n" +
             "  \"cpb\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(bclick) IS NULL THEN 0 ELSE ROUND((sum(charge) / sum(bclick)), 2) END AS cpb \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge) / sum(bclick) IS NULL THEN 0 ELSE ROUND((sum(charge) / sum(bclick)), 3) END AS cpb \",\n" +
             "    \"comment\": \"平均行为单价\"\n" +
             "  },\n" +
             "  \"downloadStart\": {\n" +
@@ -198,11 +198,11 @@ public class AccountReportConstants {
             "    \"comment\": \"安卓开始下载数\"\n" +
             "  },\n" +
             "  \"downloadStartCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / (download_started) IS NULL THEN 0 ELSE sum(charge) / sum(download_started) end AS downloadStartCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge) / (download_started) IS NULL THEN 0 ELSE round(sum(charge)/sum(download_started),3) end AS downloadStartCost \",\n" +
             "    \"comment\": \"安卓开始下载单价\"\n" +
             "  },\n" +
             "  \"downloadStartRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(bclick) != 0 THEN concat(CAST(round(sum(download_started) / sum(bclick)*100,2) AS CHAR) ,'%') else '0%' end AS downloadStartRate\",\n" +
+            "    \"filed\": \"CASE WHEN  sum(bclick) != 0 THEN round(sum(download_started)/sum(bclick)*100,2) else 0 end AS downloadStartRate\",\n" +
             "    \"comment\": \"安卓开始下载率\"\n" +
             "  },\n" +
             "  \"downloadFinish\": {\n" +
@@ -210,11 +210,11 @@ public class AccountReportConstants {
             "    \"comment\": \"安卓下载完成数\"\n" +
             "  },\n" +
             "  \"downloadFinishCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(download_completed) IS NULL THEN 0 ELSE  sum(charge) / sum(download_completed) end AS downloadFinishCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge) / sum(download_completed) IS NULL THEN 0 ELSE  round(sum(charge)/sum(download_completed),3) end AS downloadFinishCost \",\n" +
             "    \"comment\": \"安卓下载完成单价\"\n" +
             "  },\n" +
             "  \"downloadFinishRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(download_started) != 0 then  concat(CAST(round(sum(download_completed) / sum(download_started)*100,2) AS CHAR) ,'%') else '0%' end AS downloadFinishRate  \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(download_started) != 0 then  round(sum(download_completed)/sum(download_started)*100,2) else 0 end AS downloadFinishRate  \",\n" +
             "    \"comment\": \"安卓下载完成率\"\n" +
             "  },\n" +
             "  \"active\": {\n" +
@@ -222,7 +222,7 @@ public class AccountReportConstants {
             "    \"comment\": \"激活数\"\n" +
             "  },\n" +
             "  \"activeCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(activation) IS NULL THEN 0 ELSE sum(charge) / sum(activation) end AS activeCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge) / sum(activation) IS NULL THEN 0 ELSE round(sum(charge)/sum(activation),3) end AS activeCost \",\n" +
             "    \"comment\": \"激活单价\"\n" +
             "  },\n" +
             "  \"firstDayPay\": {\n" +
@@ -234,11 +234,11 @@ public class AccountReportConstants {
             "    \"comment\": \"首日付费金额\"\n" +
             "  },\n" +
             "  \"firstDayPayCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(event_pay_first_day) IS NULL THEN 0 ELSE sum(charge) / sum(event_pay_first_day) end AS firstDayPayCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge) / sum(event_pay_first_day) IS NULL THEN 0 ELSE round(sum(charge)/sum(event_pay_first_day),2) end AS firstDayPayCost \",\n" +
             "    \"comment\": \"首日付费成本\"\n" +
             "  },\n" +
             "  \"firstDayPayROI\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(event_pay_purchase_amount_first_day) / sum(charge) IS NULL THEN '0%' ELSE concat(CAST(round(sum(event_pay_purchase_amount_first_day) / sum(charge)*100,2) AS CHAR) ,'%') end AS firstDayPayROI \",\n" +
+            "    \"filed\": \"CASE WHEN sum(event_pay_purchase_amount_first_day) / sum(charge) IS NULL THEN 0 ELSE round(sum(event_pay_purchase_amount_first_day)/sum(charge)*100,2) end AS firstDayPayROI \",\n" +
             "    \"comment\": \"首日ROI\"\n" +
             "  },\n" +
             "  \"eventPay\": {\n" +
@@ -250,11 +250,11 @@ public class AccountReportConstants {
             "    \"comment\": \"付费金额\"\n" +
             "  },\n" +
             "  \"eventPayCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(event_pay) IS NULL THEN 0 ELSE sum(charge) / sum(event_pay) end AS eventPayCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge)/sum(event_pay) IS NULL THEN 0 ELSE round(sum(charge)/sum(event_pay),3) end AS eventPayCost \",\n" +
             "    \"comment\": \"付费次数成本\"\n" +
             "  },\n" +
             "  \"ROI\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(event_pay_purchase_amount) / sum(charge) IS NULL THEN '0%' ELSE concat(CAST(round(sum(event_pay_purchase_amount) / sum(charge)*100,2) AS CHAR) ,'%') end AS ROI \",\n" +
+            "    \"filed\": \"CASE WHEN sum(event_pay_purchase_amount)/sum(charge) IS NULL THEN 0 ELSE round(sum(event_pay_purchase_amount)/sum(charge)*100,2) end AS ROI \",\n" +
             "    \"comment\": \"ROI\"\n" +
             "  },\n" +
             "  \"register\": {\n" +
@@ -266,7 +266,7 @@ public class AccountReportConstants {
             "    \"comment\": \"注册成本\"\n" +
             "  },\n" +
             "  \"activeRegisterRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(activation) !=0  THEN concat(CAST(round(sum(event_register) / sum(activation)*100,2) AS CHAR) ,'%') else '0%' end as activeRegisterRate \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(activation) !=0  THEN round(sum(event_register)/sum(activation)*100,2) else 0 end as activeRegisterRate \",\n" +
             "    \"comment\": \"注册率\"\n" +
             "  },\n" +
             "  \"eventJinJianApp\": {\n" +
@@ -286,7 +286,7 @@ public class AccountReportConstants {
             "    \"comment\": \"授信成本\"\n" +
             "  },\n" +
             "  \"eventCreditGrantAppRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(event_jin_jian_app) !=0 THEN concat(CAST(round(sum(event_credit_grant_app) / sum(event_jin_jian_app)*100,2) AS CHAR) ,'%') ELSE '0' end as eventCreditGrantAppRate\",\n" +
+            "    \"filed\": \"CASE WHEN  sum(event_jin_jian_app) !=0 THEN round(sum(event_credit_grant_app)/sum(event_jin_jian_app)*100,2) ELSE 0 end as eventCreditGrantAppRate\",\n" +
             "    \"comment\": \"授信率\"\n" +
             "  },\n" +
             "  \"formCount\": {\n" +
@@ -294,11 +294,11 @@ public class AccountReportConstants {
             "    \"comment\": \"表单提交数\"\n" +
             "  },\n" +
             "  \"formCountRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(activation) != 0  THEN  concat(CAST(round(sum(form_count) / sum(activation)*100,2) AS CHAR) ,'%') else '0%' end as formCountRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(activation) != 0  THEN  round(sum(form_count)/sum(activation)*100,2) else 0 end as formCountRate \",\n" +
             "    \"comment\": \"表单提交率\"\n" +
             "  },\n" +
             "  \"formCountCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(form_count) IS NULL THEN 0 ELSE round(sum(charge)/sum(form_count),3) end as formCountCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge)/sum(form_count) IS NULL THEN 0 ELSE round(sum(charge)/sum(form_count),3) end as formCountCost \",\n" +
             "    \"comment\": \"表单提交成本\"\n" +
             "  },\n" +
             "  \"nextDayOpen\": {\n" +
@@ -306,11 +306,11 @@ public class AccountReportConstants {
             "    \"comment\": \"次留数\"\n" +
             "  },\n" +
             "  \"nextDayOpenCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(event_next_day_stay) IS NULL THEN 0 ELSE round(sum(charge)/sum(event_next_day_stay),3) end as nextDayOpenCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge)/sum(event_next_day_stay) IS NULL THEN 0 ELSE round(sum(charge)/sum(event_next_day_stay),3) end as nextDayOpenCost \",\n" +
             "    \"comment\": \"次留成本\"\n" +
             "  },\n" +
             "  \"nextDayOpenRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(activation) != 0 THEN  concat(CAST(round(sum(event_next_day_stay) / sum(activation)*100,2) AS CHAR) ,'%') ELSE '0%' end as nextDayOpenRate\",\n" +
+            "    \"filed\": \"CASE WHEN  sum(activation) != 0 THEN  round(sum(event_next_day_stay)/sum(activation)*100,2) ELSE 0 end as nextDayOpenRate\",\n" +
             "    \"comment\": \"次留率\"\n" +
             "  },\n" +
             "  \"eventJinJianLandingPage\": {\n" +
@@ -318,7 +318,7 @@ public class AccountReportConstants {
             "    \"comment\": \"落地页完件数\"\n" +
             "  },\n" +
             "  \"eventJinJianLandingPageCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(event_jin_jian_landing_page) IS NULL THEN 0 ELSE round(sum(charge)/sum(event_jin_jian_landing_page),3) end as eventJinJianLandingPageCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge)/sum(event_jin_jian_landing_page) IS NULL THEN 0 ELSE round(sum(charge)/sum(event_jin_jian_landing_page),3) end as eventJinJianLandingPageCost \",\n" +
             "    \"comment\": \"落地页完件成本\"\n" +
             "  },\n" +
             "  \"eventCreditGrantLandingPage\": {\n" +
@@ -330,7 +330,7 @@ public class AccountReportConstants {
             "    \"comment\": \"落地页授信成本\"\n" +
             "  },\n" +
             "  \"eventCreditGrantLandingPageRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(event_jin_jian_landing_page)  != 0 THEN  concat( CAST(round(sum(event_credit_grant_landing_page) / sum(event_jin_jian_landing_page)*100,2) AS CHAR),'%') ELSE '0%' end as eventCreditGrantLandingPageRate \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(event_jin_jian_landing_page)  != 0 THEN  round(sum(event_credit_grant_landing_page)/sum(event_jin_jian_landing_page)*100,2) ELSE 0 end as eventCreditGrantLandingPageRate \",\n" +
             "    \"comment\": \"落地页授信率\"\n" +
             "  },\n" +
             "  \"submit\": {\n" +
@@ -338,19 +338,19 @@ public class AccountReportConstants {
             "    \"comment\": \"按钮点击数\"\n" +
             "  },\n" +
             "  \"submitCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(submit) IS NULL THEN 0 ELSE round(sum(charge)/sum(submit),3) end as submitCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge)/sum(submit) IS NULL THEN 0 ELSE round(sum(charge)/sum(submit),3) end as submitCost \",\n" +
             "    \"comment\": \"按钮点击成本\"\n" +
             "  },\n" +
             "  \"submitRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(bclick) != 0 THEN concat(CAST(round(sum(submit) / sum(bclick)*100,2) AS CHAR) ,'%') else '0%' end as submitRate \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(bclick) != 0 THEN round(sum(submit)/sum(bclick)*100,2) else 0 end as submitRate \",\n" +
             "    \"comment\": \"按钮点击率\"\n" +
             "  },\n" +
             "  \"play3sRate\": {\n" +
-            "    \"filed\": \"(CASE WHEN  sum(aclick) != 0 THEN round( sum(play_3s_ratio * aclick) / sum(aclick) * 100,2) ELSE 0 END )AS play3sRate \",\n" +
+            "    \"filed\": \"(CASE WHEN  sum(aclick) != 0 THEN round(sum(play_3s_ratio*aclick)/sum(aclick) * 100,2) ELSE 0 END )AS play3sRate \",\n" +
             "    \"comment\": \"3s播放率\"\n" +
             "  },\n" +
             "  \"activeRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(download_completed) != 0 THEN concat(CAST(round(sum(activation) / sum(download_completed)*100,2) AS CHAR) ,'%') else '0%' end as activeRate \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(download_completed) != 0 THEN round(sum(activation)/sum(download_completed)*100,2) else 0 end as activeRate \",\n" +
             "    \"comment\": \"下载完成激活率\"\n" +
             "  }\n" +
             "}";
@@ -368,7 +368,7 @@ public class AccountReportConstants {
             "    \"comment\": \"消耗\"\n" +
             "  },\n" +
             "  \"photoShow\": {\n" +
-            "    \"filed\": \"IFNULL(sum(show),0) as photoShow \",\n" +
+            "    \"filed\": \"IFNULL(sum(`show`),0) as photoShow \",\n" +
             "    \"comment\": \"封面曝光数\"\n" +
             "  },\n" +
             "  \"photoClick\": {\n" +
@@ -384,23 +384,23 @@ public class AccountReportConstants {
             "    \"comment\": \"行为数\"\n" +
             "  },\n" +
             "  \"clickRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(show) != 0    THEN CONCAT( CAST(ROUND((sum(photo_click) / sum(show)) * 100,2) AS CHAR) ,'%') else '0%' END AS clickRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(`show`) != 0    THEN ROUND(sum(photo_click) / sum(`show`) * 100,2) else 0 END AS clickRate \",\n" +
             "    \"comment\": \"封面点击率\"\n" +
             "  },\n" +
             "  \"bClickRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(aclick) != 0 THEN CONCAT( CAST(ROUND((sum(bclick) / sum(aclick)) * 100,2) AS CHAR) ,'%') ELSE '0%' END AS bClickRate \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(aclick) != 0 THEN ROUND(sum(bclick) / sum(aclick)*100,2) ELSE 0 END AS bClickRate \",\n" +
             "    \"comment\": \"行为率\"\n" +
             "  },\n" +
             "  \"cpm\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(show) IS NULL THEN 0 ELSE ROUND((sum(charge) / sum(show)) * 1000, 2 ) END AS cpm \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge)/sum(`show`) IS NULL THEN 0 ELSE ROUND(sum(charge)/sum(`show`)*1000,3) END AS cpm \",\n" +
             "    \"comment\": \"平均千次封面曝光花费\"\n" +
             "  },\n" +
             "  \"cpc\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(photo_click) IS NULL THEN 0 ELSE ROUND((sum(charge) / sum(photo_click)), 2) END AS cpc \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge) / sum(photo_click) IS NULL THEN 0 ELSE ROUND(sum(charge)/sum(photo_click), 3) END AS cpc \",\n" +
             "    \"comment\": \"平均封面点击单价\"\n" +
             "  },\n" +
             "  \"cpb\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(bclick) IS NULL THEN 0 ELSE ROUND((sum(charge) / sum(bclick)), 2) END AS cpb \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge) / sum(bclick) IS NULL THEN 0 ELSE ROUND(sum(charge)/sum(bclick), 3) END AS cpb \",\n" +
             "    \"comment\": \"平均行为单价\"\n" +
             "  },\n" +
             "  \"downloadStart\": {\n" +
@@ -408,11 +408,11 @@ public class AccountReportConstants {
             "    \"comment\": \"安卓开始下载数\"\n" +
             "  },\n" +
             "  \"downloadStartCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / (download_started) IS NULL THEN 0 ELSE sum(charge) / sum(download_started) end AS downloadStartCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge) / (download_started) IS NULL THEN 0 ELSE round(sum(charge)/sum(download_started),2) end AS downloadStartCost \",\n" +
             "    \"comment\": \"安卓开始下载单价\"\n" +
             "  },\n" +
             "  \"downloadStartRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(bclick) != 0 THEN concat(CAST(round(sum(download_started) / sum(bclick)*100,2) AS CHAR) ,'%') else '0%' end AS downloadStartRate\",\n" +
+            "    \"filed\": \"CASE WHEN  sum(bclick) != 0 THEN round(sum(download_started) / sum(bclick)*100,2) else 0 end AS downloadStartRate\",\n" +
             "    \"comment\": \"安卓开始下载率\"\n" +
             "  },\n" +
             "  \"downloadFinish\": {\n" +
@@ -420,11 +420,11 @@ public class AccountReportConstants {
             "    \"comment\": \"安卓下载完成数\"\n" +
             "  },\n" +
             "  \"downloadFinishCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(download_completed) IS NULL THEN 0 ELSE  sum(charge) / sum(download_completed) end AS downloadFinishCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge) / sum(download_completed) IS NULL THEN 0 ELSE  round(sum(charge)/sum(download_completed),2) end AS downloadFinishCost \",\n" +
             "    \"comment\": \"安卓下载完成单价\"\n" +
             "  },\n" +
             "  \"downloadFinishRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(download_started) != 0 then  concat(CAST(round(sum(download_completed) / sum(download_started)*100,2) AS CHAR) ,'%') else '0%' end AS downloadFinishRate  \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(download_started) != 0 then round(sum(download_completed)/sum(download_started)*100,2) else 0 end AS downloadFinishRate  \",\n" +
             "    \"comment\": \"安卓下载完成率\"\n" +
             "  },\n" +
             "  \"active\": {\n" +
@@ -432,7 +432,7 @@ public class AccountReportConstants {
             "    \"comment\": \"激活数\"\n" +
             "  },\n" +
             "  \"activeCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(activation) IS NULL THEN 0 ELSE sum(charge) / sum(activation) end AS activeCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge) / sum(activation) IS NULL THEN 0 ELSE round(sum(charge)/sum(activation),3) end AS activeCost \",\n" +
             "    \"comment\": \"激活单价\"\n" +
             "  },\n" +
             "  \"firstDayPay\": {\n" +
@@ -444,7 +444,7 @@ public class AccountReportConstants {
             "    \"comment\": \"首日付费金额\"\n" +
             "  },\n" +
             "  \"firstDayPayCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(event_pay_first_day) IS NULL THEN 0 ELSE sum(charge) / sum(event_pay_first_day) end AS firstDayPayCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge)/sum(event_pay_first_day) IS NULL THEN 0 ELSE round(sum(charge)/sum(event_pay_first_day),3) end AS firstDayPayCost \",\n" +
             "    \"comment\": \"首日付费成本\"\n" +
             "  },\n" +
             "  \"firstDayPayROI\": {\n" +
@@ -460,7 +460,7 @@ public class AccountReportConstants {
             "    \"comment\": \"付费金额\"\n" +
             "  },\n" +
             "  \"eventPayCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(event_pay) IS NULL THEN 0 ELSE sum(charge) / sum(event_pay) end AS eventPayCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge) / sum(event_pay) IS NULL THEN 0 ELSE round(sum(charge)/sum(event_pay),3) end AS eventPayCost \",\n" +
             "    \"comment\": \"付费次数成本\"\n" +
             "  },\n" +
             "  \"ROI\": {\n" +
@@ -476,7 +476,7 @@ public class AccountReportConstants {
             "    \"comment\": \"注册成本\"\n" +
             "  },\n" +
             "  \"activeRegisterRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(activation) !=0  THEN concat(CAST(round(sum(event_register) / sum(activation)*100,2) AS CHAR) ,'%') else '0%' end as activeRegisterRate \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(activation) !=0  THEN round(sum(event_register)/sum(activation)*100,2) else 0 end as activeRegisterRate \",\n" +
             "    \"comment\": \"注册率\"\n" +
             "  },\n" +
             "  \"eventJinJianApp\": {\n" +
@@ -496,7 +496,7 @@ public class AccountReportConstants {
             "    \"comment\": \"授信成本\"\n" +
             "  },\n" +
             "  \"eventCreditGrantAppRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(event_jin_jian_app) !=0 THEN concat(CAST(round(sum(event_credit_grant_app) / sum(event_jin_jian_app)*100,2) AS CHAR) ,'%') ELSE '0' end as eventCreditGrantAppRate\",\n" +
+            "    \"filed\": \"CASE WHEN  sum(event_jin_jian_app) !=0 THEN round(sum(event_credit_grant_app)/sum(event_jin_jian_app)*100,2) ELSE 0 end as eventCreditGrantAppRate\",\n" +
             "    \"comment\": \"授信率\"\n" +
             "  },\n" +
             "  \"formCount\": {\n" +
@@ -504,7 +504,7 @@ public class AccountReportConstants {
             "    \"comment\": \"表单提交数\"\n" +
             "  },\n" +
             "  \"formCountRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(activation) != 0  THEN  concat(CAST(round(sum(form_count) / sum(activation)*100,2) AS CHAR) ,'%') else '0%' end as formCountRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(activation) != 0  THEN round(sum(form_count)/sum(activation)*100,2) else 0 end as formCountRate \",\n" +
             "    \"comment\": \"表单提交率\"\n" +
             "  },\n" +
             "  \"formCountCost\": {\n" +
@@ -520,7 +520,7 @@ public class AccountReportConstants {
             "    \"comment\": \"次留成本\"\n" +
             "  },\n" +
             "  \"nextDayOpenRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(activation) != 0 THEN  concat(CAST(round(sum(event_next_day_stay) / sum(activation)*100,2) AS CHAR) ,'%') ELSE '0%' end as nextDayOpenRate\",\n" +
+            "    \"filed\": \"CASE WHEN  sum(activation) != 0 THEN round(sum(event_next_day_stay)/sum(activation)*100,2) ELSE 0 end as nextDayOpenRate\",\n" +
             "    \"comment\": \"次留率\"\n" +
             "  },\n" +
             "  \"eventJinJianLandingPage\": {\n" +
@@ -540,7 +540,7 @@ public class AccountReportConstants {
             "    \"comment\": \"落地页授信成本\"\n" +
             "  },\n" +
             "  \"eventCreditGrantLandingPageRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(event_jin_jian_landing_page)  != 0 THEN  concat( CAST(round(sum(event_credit_grant_landing_page) / sum(event_jin_jian_landing_page)*100,2) AS CHAR),'%') ELSE '0%' end as eventCreditGrantLandingPageRate \",\n" +
+            "    \"filed\": \"CASE WHEN sum(event_jin_jian_landing_page)!=0 THEN round(sum(event_credit_grant_landing_page)/sum(event_jin_jian_landing_page)*100,2) ELSE 0 end as eventCreditGrantLandingPageRate \",\n" +
             "    \"comment\": \"落地页授信率\"\n" +
             "  },\n" +
             "  \"submit\": {\n" +
@@ -548,23 +548,23 @@ public class AccountReportConstants {
             "    \"comment\": \"按钮点击数\"\n" +
             "  },\n" +
             "  \"submitCost\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(charge) / sum(submit) IS NULL THEN 0 ELSE round(sum(charge)/sum(submit),3) end as submitCost \",\n" +
+            "    \"filed\": \"CASE WHEN sum(charge)/sum(submit) IS NULL THEN 0 ELSE round(sum(charge)/sum(submit),3) end as submitCost \",\n" +
             "    \"comment\": \"按钮点击成本\"\n" +
             "  },\n" +
             "  \"submitRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(bclick) != 0 THEN concat(CAST(round(sum(submit) / sum(bclick)*100,2) AS CHAR) ,'%') else '0%' end as submitRate \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(bclick) != 0 THEN round(sum(submit)/sum(bclick)*100,2) else 0 end as submitRate \",\n" +
             "    \"comment\": \"按钮点击率\"\n" +
             "  },\n" +
             "  \"activeRate\": {\n" +
-            "    \"filed\": \"CASE WHEN  sum(download_completed) != 0 THEN concat(CAST(round(sum(activation) / sum(download_completed)*100,2) AS CHAR) ,'%') else '0%' end as activeRate \",\n" +
+            "    \"filed\": \"CASE WHEN  sum(download_completed) != 0 THEN round(sum(activation)/sum(download_completed)*100,2) else 0 end as activeRate \",\n" +
             "    \"comment\": \"下载完成激活率\"\n" +
             "  },\n" +
             "  \"play3sCount\": {\n" +
-            "    \"filed\": \"sum(play_3s_count) as play3sCount\",\n" +
+            "    \"filed\": \"sum(play_3s_ratio*aclick) as play3sCount\",\n" +
             "    \"comment\": \"3s播放数\"\n" +
             "  },\n" +
             "  \"play3sRate\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(aclick) != 0 THEN CONCAT(CAST(ROUND( sum(play_3s_count) / sum(aclick),2 )  * 100 AS CHAR),'%') ELSE '-' END AS play3sRate\",\n" +
+            "    \"filed\": \"CASE WHEN sum(aclick) != 0 THEN ROUND(sum(play_3s_count)/sum(aclick)* 100,2 ) ELSE 0 END AS play3sRate\",\n" +
             "    \"comment\": \"3s播放率\"\n" +
             "  }\n" +
             "}";
@@ -760,16 +760,13 @@ public class AccountReportConstants {
             "  }\n" +
             "}";
 
-    public static void main(String[] args) {
-        System.out.println(BYTEDANCE_VIDEO_REPORT_MAPPING_JSON);
-    }
     public static final String BYTEDANCE_VIDEO_REPORT_MAPPING_JSON = "{\n" +
             "  \"cost\": {\n" +
             "    \"filed\": \"IFNULL(sum(t1.cost),0) as cost \",\n" +
             "    \"comment\": \"消耗\"\n" +
             "  },\n" +
             "  \"cpm\": {\n" +
-            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.material_show) IS NULL THEN 0 ELSE ROUND((sum(t1.cost) / sum(t1.material_show)) * 1000, 2 ) END AS cpm \",\n" +
+            "    \"filed\": \"CASE WHEN sum(t1.cost) / sum(t1.material_show) IS NULL THEN 0 ELSE ROUND(sum(t1.cost)/sum(t1.material_show)*1000,2) END AS cpm \",\n" +
             "    \"comment\": \"平均千次展现费用\"\n" +
             "  },\n" +
             "  \"clickMaterial\": {\n" +

+ 1 - 1
jeecg-boot-report/src/main/java/cn/com/ctop/common/mapper/xml/ProjectMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="cn.com.ctop.common.mapper.ProjectMapper">
 
     <select id="getListByParams" resultType="cn.com.ctop.common.entity.Project">
-        select * from hcst_system.ctop_project where 1=1
+        select * from `jeecg-boot`.ctop_project where 1=1
         and media_id in
         <foreach collection="mediaIds" item="item" separator=","
                  open="(" close=")">

+ 29 - 28
jeecg-boot-report/src/main/java/cn/com/ctop/common/mapper/xml/ProjectMemberMapper.xml

@@ -5,15 +5,15 @@
     <select id="selectProjectsByUserId" resultType="java.lang.Long">
         select
         DISTINCT(project_id)
-         from ctop_project_member
+         from `jeecg-boot`.ctop_project_member
         where user_id = #{userId}
     </select>
 
     <select id="selectProductsByUserId" resultType="java.lang.Long">
-        select  DISTINCT(product_id) from ctop_project where product_id is not NULL  and id in
+        select  DISTINCT(product_id) from `jeecg-boot`.ctop_project where product_id is not NULL  and id in
          (select
               DISTINCT(project_id)
-          from ctop_project_member where user_id = #{userId})
+          from `jeecg-boot`.ctop_project_member where user_id = #{userId})
     </select>
 
     <!-- 设计师展示所有自己的角色下制作的视频 -->
@@ -23,7 +23,7 @@
         t1.project_name as projectName,
         t1.advertiser_id as advertiserId,
         (
-        select name from ctop_advertiser where id = t1.advertiser_id
+        select name from `jeecg-boot`.ctop_advertiser where id = t1.advertiser_id
         )
         as advertiserName,
         t1.media_id as mediaId,
@@ -31,7 +31,7 @@
         t1.product_id as productId,
         t1.responsible_name as responsibleName
         from
-        ctop_project t1
+        `jeecg-boot`.ctop_project t1
         where
         media_id in
         <foreach collection="mediaIds" item="item" separator=","
@@ -51,7 +51,7 @@
         b.product_id as productId,
         b.media_id as mediaId
         from
-        ctop_project_member a
+        `jeecg-boot`.ctop_project_member a
         left join ctop_project b on a.project_id = b.id
         where
         b.company_id = #{companyId}
@@ -72,7 +72,7 @@
         b.media_id as mediaId,
         b.product_id as productId
         from
-        ctop_project_member a
+        `jeecg-boot`.ctop_project_member a
         left join ctop_project b on a.project_id = b.id
         where a.user_id = #{userId}
         and b.media_id in
@@ -91,7 +91,7 @@
         b.media_id as mediaId,
         b.product_id as productId
         from
-        ctop_project_member a
+        `jeecg-boot`.ctop_project_member a
         left join ctop_project b on a.project_id = b.id
         where b.product_id = #{productId}
         <if test="userId !=null and userId!=''">
@@ -116,7 +116,7 @@
         b.product_id as productId,
         b.media_id as mediaId
         from
-        hcst_system.ctop_user_allocation a
+        `jeecg-boot`.ctop_user_allocation a
         left join hcst_system.ctop_project b on a.project_id = b.id
         where a.user_id = #{userId}
         and b.media_id in
@@ -130,7 +130,7 @@
         select
         role_code
         from
-            hcst_system.sys_user_role a
+            `jeecg-boot`.sys_user_role a
         left join sys_role b on a.role_id = b.id
         where a.user_id = #{userId}
     </select>
@@ -139,7 +139,7 @@
             select
             company_id
         from
-            hcst_system.user_company
+            `jeecg-boot`.user_company
         where user_id = #{userId}
     </select>
 
@@ -152,19 +152,19 @@
         SELECT
         NAME
         FROM
-        ctop_advertiser
+        `jeecg-boot`.ctop_advertiser
         WHERE
         id = t1.advertiser_id
         ) AS 'advertiserName',
         t1.media_id as 'mediaId'
         FROM
-        ctop_project t1
+        `jeecg-boot`.ctop_project t1
         WHERE
         t1.id IN (
         SELECT
         project_id
         FROM
-        hcst_system.ctop_project_member
+        `jeecg-boot`.ctop_project_member
         where user_id = #{userId}
         GROUP BY
         project_id
@@ -187,7 +187,7 @@
         a.sale_id as saleId,
         b.realname as saleName
         from
-        hcst_system.ctop_project a
+        `jeecg-boot`.ctop_project a
         left join sys_user b on a.sale_id = b.id
         where a.sale_id = #{userId}
         and a.media_id in
@@ -199,7 +199,7 @@
 
     <select id="getProjectByMap" resultType="java.lang.Long">
         select project_id
-        from hcst_system.ctop_project_member
+        from `jeecg-boot`.ctop_project_member
         where user_id = #{userId}
         group by project_id
     </select>
@@ -207,7 +207,8 @@
         select
             project.*
         from
-            hcst_system.ctop_project_member member left join hcst_system.ctop_project project on project.id = member.project_id
+            `jeecg-boot`.ctop_project_member member
+            left join `jeecg-boot`.ctop_project project on project.id = member.project_id
         where
             member.user_id = #{userId}
     </select>
@@ -216,7 +217,7 @@
         SELECT
         project_id
         FROM
-        hcst_system.ctop_user_allocation
+        `jeecg-boot`.ctop_user_allocation
         WHERE
         account_id IN
         <foreach collection="accountIds" item="item" separator=","
@@ -230,7 +231,7 @@
         (SELECT
         project_id
         FROM
-        hcst_system.ctop_user_allocation
+        `jeecg-boot`.ctop_user_allocation
         WHERE
         account_id IN
         <foreach collection="accountIds" item="item" separator=","
@@ -247,10 +248,10 @@
         t3.product_name  as 'productName',
         t2.advertiser_id as 'advertiserId',
         t4.`name`        as 'advertiserName'
-        from hcst_system.ctop_project_member t1
-        left join hcst_system.ctop_project t2 on t1.project_id = t2.id
-        left join hcst_system.ctop_product t3 on t3.id = t2.product_id
-        left join hcst_system.ctop_advertiser t4 on t2.advertiser_id = t4.id
+        from `jeecg-boot`.ctop_project_member t1
+        left join `jeecg-boot`.ctop_project t2 on t1.project_id = t2.id
+        left join `jeecg-boot`.ctop_product t3 on t3.id = t2.product_id
+        left join `jeecg-boot`.ctop_advertiser t4 on t2.advertiser_id = t4.id
         where 1 = 1
         <if test="userId !=null and userId!=''">
             and t1.user_id = #{userId}
@@ -274,8 +275,8 @@
         SELECT
         t1.id
         FROM
-        hcst_system.ctop_project t1
-        LEFT JOIN hcst_system.ctop_project_member t2 ON t1.id = t2.project_id
+        `jeecg-boot`.ctop_project t1
+        LEFT JOIN `jeecg-boot`.ctop_project_member t2 ON t1.id = t2.project_id
         WHERE
         t2.user_id = #{userId}
         <if test="productId != null and productId != ''">
@@ -286,9 +287,9 @@
     </select>
     <select id="getlistByUserId" resultType="cn.com.ctop.common.entity.ProjectMember">
         select cp.id as id, cp.project_name as project_name, cp.media_id as media_id, ca.name as advertiser_name
-        from hcst_system.ctop_project_member cpm
-                 left join hcst_system.ctop_project cp on cpm.project_id = cp.id
-                 left join hcst_system.ctop_advertiser ca on ca.id = cp.advertiser_id
+        from `jeecg-boot`.ctop_project_member cpm
+                 left join `jeecg-boot`.ctop_project cp on cpm.project_id = cp.id
+                 left join `jeecg-boot`.ctop_advertiser ca on ca.id = cp.advertiser_id
         where 1=1
         <if test="userId!=null">
             and cpm.user_id = #{userId}

+ 1 - 1
jeecg-boot-report/src/main/java/cn/com/ctop/common/mapper/xml/SysDepartMapper.xml

@@ -6,7 +6,7 @@
         select
                *
         from
-        hcst_system.sys_depart
+        `jeecg-boot`.sys_depart
         where
               1=1
               <if test="orgType!=null">

+ 5 - 5
jeecg-boot-report/src/main/java/cn/com/ctop/common/mapper/xml/SysRoleMapper.xml

@@ -5,23 +5,23 @@
     <!-- 根据roleCode获取roleId -->
     <select id="getRoleIdByRoleCode" resultType="java.lang.String">
         select id
-        from hcst_system.sys_role
+        from `jeecg-boot`.sys_role
         where role_code = #{roleCode}
     </select>
 
     <!-- 根据userId获取角色code -->
     <select id="getRoleCodeByUserId" resultType="java.lang.String">
         select c.role_code
-        from hcst_system.sys_user a
-                 left join hcst_system.sys_user_role b on a.id = b.user_id
-                 left join hcst_system.sys_role c on b.role_id = c.id
+        from `jeecg-boot`.sys_user a
+                 left join `jeecg-boot`.sys_user_role b on a.id = b.user_id
+                 left join `jeecg-boot`.sys_role c on b.role_id = c.id
         where a.id = #{userId}
     </select>
 
 
     <select id="queryRoleByUserId" resultType="cn.com.ctop.common.entity.SysRole">
         SELECT t2.role_name,t2.role_code
-        FROM hcst_system.sys_user_role t1
+        FROM `jeecg-boot`.sys_user_role t1
                  LEFT JOIN sys_role t2 ON t1.role_id = t2.id
         WHERE t1.user_id = #{userId} LIMIT 1
     </select>

+ 1 - 1
jeecg-boot-report/src/main/java/cn/com/ctop/common/mapper/xml/SysUserMapper.xml

@@ -3,6 +3,6 @@
 <mapper namespace="cn.com.ctop.common.mapper.SysUserMapper">
 
     <select id="selectAllUser" resultType="org.jeecg.common.system.entity.SysUser">
-        select * from hcst_system.sys_user where del_flag = 0 and status = 1
+        select * from `jeecg-boot`.sys_user where del_flag = 0 and status = 1
     </select>
 </mapper>

+ 3 - 3
jeecg-boot-report/src/main/java/cn/com/ctop/common/mapper/xml/UserAllocationMapper.xml

@@ -3,16 +3,16 @@
 <mapper namespace="cn.com.ctop.common.mapper.UserAllocationMapper">
 
     <select id="queryListWithPermission" resultType="cn.com.ctop.common.entity.UserAllocation">
-        select * from hcst_system.user_allocation where 1=1 ${permissionSql}
+        select * from `jeecg-boot`.user_allocation where 1=1 ${permissionSql}
     </select>
     <select id="getAccountListByProjectList" resultType="com.alibaba.fastjson.JSONObject">
         select
         t1.project_id as 'projectId',
         t1.account_id as 'accountId',
-        (select realname from hcst_system.sys_user where id = t1.user_id ) as 'userName',
+        (select realname from `jeecg-boot`.sys_user where id = t1.user_id ) as 'userName',
         t1.auth_name as 'authName',
         t1.account_status as 'accountStatus'
-        from hcst_system.ctop_user_allocation t1
+        from `jeecg-boot`.ctop_user_allocation t1
         where t1.project_id in
         <foreach collection="list" item="item" separator=","
                  open="(" close=")">

+ 10 - 5
jeecg-boot-report/src/main/java/cn/com/ctop/report/controller/KuaishouAccountReportDailyDwController.java

@@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.math.BigDecimal;
+import java.text.ParseException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -41,7 +43,7 @@ public class KuaishouAccountReportDailyDwController {
         resultMap.put("message","获取数据成功");
         resultMap.put("code","0");
         resultMap.put("success",true);
-        resultMap.put("result",dataList);
+        resultMap.put("data",dataList);
         return resultMap;
     }
 
@@ -49,13 +51,13 @@ public class KuaishouAccountReportDailyDwController {
      * 查询账户报表数据
      */
     @PostMapping("/kuaishou/list")
-    public Result<List<JSONObject>> getListReport(@RequestBody JSONObject requestBody) {
+    public Result<List<JSONObject>> getListReport(@RequestBody JSONObject requestBody) throws ParseException {
         Result<List<JSONObject>> result = new Result<>();
         if (requestBody.isEmpty()) {
             log.error("request body is empty");
             result.setSuccess(false);
         }
-        BigDecimal discount = requestBody.getBigDecimal("discount");
+        BigDecimal discount = requestBody.getBigDecimal("disscount");
         JSONArray accounts = requestBody.getJSONArray("accountIds");
         String userId = requestBody.getString("userId");
         if (accounts.isEmpty()) {
@@ -67,7 +69,10 @@ public class KuaishouAccountReportDailyDwController {
         }
         String startDate = requestBody.getString("startDate");
         String endDate = requestBody.getString("endDate");
-        int hour = requestBody.getInteger("hour");
+        Integer hour = requestBody.getInteger("hour");
+        if(null == hour){
+            hour = DateUtils.getNowHour();
+        }
         String target = requestBody.getString("target");
         String order = requestBody.getString("order");
         try {
@@ -93,7 +98,7 @@ public class KuaishouAccountReportDailyDwController {
             resultBody.setSuccess(false);
         }
         String mediaId = requestBody.getString("mediaId");
-        BigDecimal discount = requestBody.getBigDecimal("discount");
+        BigDecimal discount = requestBody.getBigDecimal("disscount");
         JSONArray accounts = requestBody.getJSONArray("accountIds");
         if (accounts.isEmpty()) {
             return resultBody;

+ 4 - 4
jeecg-boot-report/src/main/java/cn/com/ctop/report/controller/KuaishouMaterialReportDailyDwController.java

@@ -115,8 +115,8 @@ public class KuaishouMaterialReportDailyDwController {
             }
             Map<String, Object> requestMap = new HashMap<>();
             requestMap.put("filed", filedAll);
-            requestMap.put("startDate", startDate);
-            requestMap.put("endDate", endDate);
+            requestMap.put("startDate", Long.parseLong(startDate.replace("-","")));
+            requestMap.put("endDate", Long.parseLong(endDate.replace("-","")));
 
             if (!Check.isNull(requestBody.getJSONArray("accountIds"))) {
                 requestMap.put("accountIds", requestBody.getJSONArray("accountIds"));
@@ -128,8 +128,8 @@ public class KuaishouMaterialReportDailyDwController {
             if (!Check.isNull(requestBody.getString("order"))) {
                 requestMap.put("order", requestBody.getString("order"));
             }
-            if (!Check.isNull(requestBody.getString("channelType"))) {
-                requestMap.put("channelType", requestBody.getString("channelType"));
+            if (!Check.isNull(requestBody.getInteger("channelType"))) {
+                requestMap.put("channelType", requestBody.getInteger("channelType"));
             }
             String roleCode = sysRoleMapper.getRoleCodeByUserId(userId);
             if ("admin".equals(roleCode)) {

+ 5 - 1
jeecg-boot-report/src/main/java/cn/com/ctop/report/entity/AccountAttributionInfo.java

@@ -1,5 +1,6 @@
 package cn.com.ctop.report.entity;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModel;
@@ -19,11 +20,14 @@ public class AccountAttributionInfo {
     private Long productId;
     private String advertiserId;
     private String companyId;
-    private String accountName;
     private String projectName;
     private String advertiserName;
     private String companyName;
     private String saleId;
     private String userId;
     private String orgCode;
+    @TableField(exist = false)
+    private String userName;
+    @TableField(exist = false)
+    private String authName;
 }

+ 6 - 6
jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/AccountAttributionInfoMapper.java

@@ -16,20 +16,20 @@ public interface AccountAttributionInfoMapper extends BaseMapper<AccountAttribut
     List<AccountAttributionInfo> selectDesignAccuntsByParams(@Param(value = "mediaList")List<Integer> mediaList, @Param(value = "designUserId")String designUserId);
 
     //今日汇总数据
-    JSONObject queryTodaySumReportBy(@Param("statDate") String statDate, @Param("accountIds") JSONArray accountIds);
+    JSONObject queryTodaySumReportBy(@Param("statDate") Long statDate, @Param("accountIds") JSONArray accountIds);
 
     //根据小时区间查询今日汇总数据
-    JSONObject queryTodaySumByHour(@Param("statDate") String statDate, @Param("hour") int hour, @Param("accountIds") JSONArray accountIds);
+    JSONObject queryTodaySumByHour(@Param("statDate") Long statDate, @Param("hour") int hour, @Param("accountIds") JSONArray accountIds);
 
     //根据开始、结束时间 查询汇总数据
-    JSONObject querySumByStartEndDate(@Param("endDate") String endDate, @Param("startDate") String startDate, @Param("accountIds") JSONArray accountIds);
+    JSONObject querySumByStartEndDate(@Param("endDate") Long endDate, @Param("startDate") Long startDate, @Param("accountIds") JSONArray accountIds);
 
     //今日明细数据
-    List<JSONObject> queryTodayDetailReportBy(@Param("filed") String filed, @Param("statDate") String statDate, @Param("accountIds") JSONArray accountIds);
+    List<JSONObject> queryTodayDetailReportBy(@Param("filed") String filed, @Param("statDate") Long statDate, @Param("accountIds") JSONArray accountIds);
 
     //按月分组查询明细数据
-    List<JSONObject> queryDetailGroupMonthByDate(@Param("endDate") String endDate, @Param("startDate") String startDate, @Param("accountIds") JSONArray accountIds);
+    List<JSONObject> queryDetailGroupMonthByDate(@Param("endDate") Long endDate, @Param("startDate") Long startDate, @Param("accountIds") JSONArray accountIds);
 
     //根据开始、结束时间 查询明细数据
-    List<JSONObject> queryDetailByStartEndDate(@Param("endDate") String endDate, @Param("startDate") String startDate, @Param("accountIds") JSONArray accountIds);
+    List<JSONObject> queryDetailByStartEndDate(@Param("endDate") Long endDate, @Param("startDate") Long startDate, @Param("accountIds") JSONArray accountIds);
 }

+ 1 - 1
jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/KuaishouAccountReportDailyDwMapper.java

@@ -9,5 +9,5 @@ import org.apache.ibatis.annotations.Param;
 import java.util.List;
 
 public interface KuaishouAccountReportDailyDwMapper extends BaseMapper<KuaishouAccountReportDailyDw> {
-    List<JSONObject> getReportByParams(@Param(value = "filedAll") String filedAll, @Param(value = "endDate")String endDate, @Param(value = "startDate")String startDate, @Param(value = "accounts")JSONArray accounts, @Param(value = "target")String target, @Param(value = "order")String order, @Param(value = "hasGroupBy")int hasGroupBy,@Param(value = "groupBy")String groupBy);
+    List<JSONObject> getReportByParams(@Param(value = "filedAll") String filedAll, @Param(value = "endDate")Long endDate, @Param(value = "startDate")Long startDate, @Param(value = "accountIds")JSONArray accounts, @Param(value = "target")String target, @Param(value = "order")String order, @Param(value = "hasGroupBy")int hasGroupBy,@Param(value = "groupBy")String groupBy);
 }

+ 1 - 1
jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/KuaishouAccountReportHourlyDwMapper.java

@@ -9,5 +9,5 @@ import org.apache.ibatis.annotations.Param;
 import java.util.List;
 
 public interface KuaishouAccountReportHourlyDwMapper extends BaseMapper<KuaishouAccountReportHourlyDw> {
-    List<JSONObject> getReportByParams(@Param(value = "filedAll") String filedAll, @Param(value = "startDate")String startDate, @Param(value = "hour")int hour, @Param(value = "accounts")JSONArray accounts, @Param(value = "target")String target, @Param(value = "order")String order, @Param(value = "hasGroupBy")int hasGroupBy,@Param(value = "groupBy")String groupBy);
+    List<JSONObject> getReportByParams(@Param(value = "filedAll") String filedAll, @Param(value = "startDate")Long startDate, @Param(value = "hour")int hour, @Param(value = "accounts")JSONArray accounts, @Param(value = "target")String target, @Param(value = "order")String order, @Param(value = "hasGroupBy")int hasGroupBy,@Param(value = "groupBy")String groupBy);
 }

+ 1 - 1
jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/KuaishouMaterialVideoReportDailyDwMapper.java

@@ -12,7 +12,7 @@ import java.util.Map;
 public interface KuaishouMaterialVideoReportDailyDwMapper extends BaseMapper<KuaishouMaterialVideoReportDailyDw> {
     Long getTotalByMap(Map<String, Object> requestMap);
 
-    List getKuaiShouVideoReportByMap(Map<String, Object> requestMap);
+    List<JSONObject> getKuaiShouVideoReportByMap(Map<String, Object> requestMap);
 
     List<JSONObject> queryVideoDetailBy(@Param("accountIds") JSONArray accountIds, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("filed") String filed, @Param("signature") String signature);
 }

+ 20 - 19
jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/xml/AccountAttributionInfoMapper.xml

@@ -3,7 +3,7 @@
 <mapper namespace="cn.com.ctop.report.mapper.AccountAttributionInfoMapper">
 
     <insert id="reloadData">
-        replace into hcst_system.ctop_account_attribution_info(id, account_id, project_id, product_id, advertiser_id, company_id,
+        replace into `jeecg-boot`.ctop_account_attribution_info(id, account_id, project_id, product_id, advertiser_id, company_id,
                                           account_name, project_name, advertiser_name, company_name, sale_id, user_id,
                                           org_code)
         select cua.account_id,
@@ -19,18 +19,20 @@
                cp.sale_id,
                su.id,
                su.org_code
-        from hcst_system.ctop_user_allocation cua
-                 left join hcst_system.ctop_project cp on cua.project_id = cp.id
-                 left join hcst_system.ctop_advertiser ca on ca.id = cua.advertiser_id
-                 left join hcst_system.sys_user su on su.id = cua.user_id
-                 left join hcst_system.user_company uc on uc.user_id = cua.user_id
-                 left join hcst_system.ctop_product product on product.id = cp.product_id where cua.account_id is not null;
+        from `jeecg-boot`.ctop_user_allocation cua
+                 left join `jeecg-boot`.ctop_project cp on cua.project_id = cp.id
+                 left join `jeecg-boot`.ctop_advertiser ca on ca.id = cua.advertiser_id
+                 left join `jeecg-boot`.sys_user su on su.id = cua.user_id
+                 left join `jeecg-boot`.user_company uc on uc.user_id = cua.user_id
+                 left join `jeecg-boot`.ctop_product product on product.id = cp.product_id where cua.account_id is not null;
     </insert>
     <select id="selectByParams" resultType="cn.com.ctop.report.entity.AccountAttributionInfo">
         select
-               caai.*
-        from hcst_system.ctop_user_allocation cua
-        left join hcst_system.ctop_account_attribution_info caai on caai.account_id = cua.account_id
+               caai.*,
+               cua.auth_name,
+               cua.user_name
+        from `jeecg-boot`.ctop_user_allocation cua
+        left join `jeecg-boot`.ctop_account_attribution_info caai on caai.account_id = cua.account_id
         where cua.media_id in
         <foreach collection="mediaList" item="item" separator=","
                  open="(" close=")">
@@ -53,12 +55,11 @@
                 #{userId}
             </foreach>
         </if>
-        and cua.account_status = 0
     </select>
     <select id="selectDesignAccuntsByParams" resultType="cn.com.ctop.report.entity.AccountAttributionInfo">
         select caai.*
-        from hcst_system.ctop_user_allocation cua
-                 left join hcst_system.ctop_account_attribution_info caai on cua.account_id = caai.account_id
+        from `jeecg-boot`.ctop_user_allocation cua
+                 left join `jeecg-boot`.ctop_account_attribution_info caai on cua.account_id = caai.account_id
         where cua.account_status = 0
         <if test="mediaList != null">
             and cua.media_id in
@@ -73,7 +74,7 @@
         <select id="queryTodaySumReportBy" resultType="com.alibaba.fastjson.JSONObject">
             SELECT
             ROUND(sum(charge),3) cost,
-            sum(photo_show) photoShow,
+            sum('show') photoShow,
             sum(photo_click) photoClick,
             sum(aClick) as aClick,
             max(stat_hour) maxHour
@@ -91,7 +92,7 @@
         <select id="queryTodaySumByHour" resultType="com.alibaba.fastjson.JSONObject">
             SELECT
             ROUND(sum(charge),2) cost,
-            sum(photo_show) photoShow,
+            sum(`show`) photoShow,
             sum(photo_click) photoClick,
             sum(aClick) as aClick
             FROM
@@ -110,7 +111,7 @@
         <select id="queryTodayDetailReportBy" resultType="com.alibaba.fastjson.JSONObject">
             SELECT
             ROUND(sum(charge),3) cost,
-            sum(photo_show) photoShow,
+            sum(`show`) photoShow,
             sum(photo_click) photoClick,
             sum(aClick) as aClick,
             stat_hour as statHour
@@ -133,7 +134,7 @@
         <select id="querySumByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
             SELECT
             ROUND(sum(charge),3) cost,
-            sum(photo_show) photoShow,
+            sum(`show`) photoShow,
             sum(photo_click) photoClick,
             sum(aClick) as aClick
             FROM kuaishou_account_report_daily_dw t1
@@ -151,7 +152,7 @@
         <select id="queryDetailByStartEndDate" resultType="com.alibaba.fastjson.JSONObject">
             SELECT
             ROUND(sum(charge),3) cost,
-            sum(photo_show) photoShow,
+            sum(`show`) photoShow,
             sum(photo_click) photoClick,
             sum(aClick) as aClick,
             stat_date as statDate
@@ -171,7 +172,7 @@
         <select id="queryDetailGroupMonthByDate" resultType="com.alibaba.fastjson.JSONObject">
             SELECT
             ROUND(sum(charge),3) cost,
-            sum(photo_show) photoShow,
+            sum(`show`) photoShow,
             sum(photo_click) photoClick,
             sum(aClick) as aClick,
             DATE_FORMAT(t1.stat_date, '%Y-%m') statDate

+ 3 - 3
jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/xml/KuaishouAccountReportDailyDwMapper.xml

@@ -6,10 +6,10 @@
         SELECT
         stat_date as statDate,
         account_id as accountId,
-        auth_name as authName,
-        ${filed}
+        account_name as authName,
+        ${filedAll}
         FROM
-        ctop_kuaishou_report_daily_account
+        kuaishou_account_report_daily_dw
         WHERE
         stat_date &lt;= #{endDate}
         AND stat_date &gt;= #{startDate}

+ 22 - 25
jeecg-boot-report/src/main/java/cn/com/ctop/report/mapper/xml/KuaishouMaterialVideoReportDailyDwMapper.xml

@@ -8,7 +8,7 @@
         FROM
         (select
         t1.signature
-        from ctop_etl_kuaishou_account_material_report_daily t1
+        from kuaishou_material_video_report_daily_dw t1
         where 1 = 1
         <if test="accountIds !=null and accountIds != ''">
             and t1.account_id in
@@ -23,45 +23,42 @@
         <if test="endDate !=null and endDate != ''">
             AND t1.stat_date &lt;= #{endDate}
         </if>
-        GROUP BY t1.signature
-        ) t1
-        LEFT JOIN ctop_etl_kuaishou_video_info t2
-        ON t1.signature = t2.video_code
-        WHERE
-        1 = 1
         <if test="leaderId !=null and leaderId != ''">
-            AND t2.design_team_leader_id = #{leaderId}
+            AND t1.leader_id = #{leaderId}
         </if>
         <if test="channelType != null">
-            AND t2.channel_type = #{channelType}
+            AND t1.channel_type = #{channelType}
         </if>
         <if test="clipId !=null and clipId != ''">
-            AND t2.clip_id = #{clipId}
+            AND t1.clip_id = #{clipId}
         </if>
         <if test="planId !=null and planId != ''">
-            AND t2.plan_id = #{planId}
+            AND t1.plan_id = #{planId}
         </if>
         <if test="shotId !=null and shotId != ''">
-            AND t2.shot_id = #{shotId}
+            AND t1.shot_id = #{shotId}
         </if>
         <if test="companyId !=null and companyId != ''">
-            AND t2.company_id = #{companyId}
+            AND t1.company_id = #{companyId}
         </if>
+        GROUP BY t1.signature
+        ) t2
     </select>
-    <select id="getKuaiShouVideoReportByMap" resultType="java.util.List">
+    <select id="getKuaiShouVideoReportByMap" resultType="com.alibaba.fastjson.JSONObject" parameterType="map">
         SELECT
-        t1.*,
-        IFNULL(t1.clip_name,'-') as clip,
-        IFNULL(t1.plan_name,'-') as plan,
-        IFNULL(t1.shot_name,'-') as shot,
-        IFNULL(t1.design_team_leader_name,'-') as designLeader,
-        IFNULL(t1.video_name,'-') as materialName,
-        IFNULL(t1.cover_url,'-') as coverUrl,
-        IFNULL(t1.url,'-') as url ,
-        IFNULL(t1.channel_name,'-') AS channel,
-        IFNULL(t1.state_date,'-') as createTime
+        t1.*
         FROM
-        (select ${filed}
+        (select
+        IFNULL( clip_name, '-' ) AS clip,
+        IFNULL( plan_name, '-' ) AS plan,
+        IFNULL( shot_name, '-' ) AS shot,
+        IFNULL( leader_name, '-' ) AS designLeader,
+        IFNULL( video_name, '-' ) AS materialName,
+        IFNULL( cover_url, '-' ) AS coverUrl,
+        IFNULL( photo_url, '-' ) AS url,
+        IFNULL( channel_type, '-' ) AS channel,
+        IFNULL( stat_date, '-' ) AS createTime,
+                ${filed}
         from kuaishou_material_video_report_daily_dw
         where 1 = 1
         <if test="accountIds !=null and accountIds != ''">

+ 21 - 11
jeecg-boot-report/src/main/java/cn/com/ctop/report/service/impl/AccountAttributionInfoServiceImpl.java

@@ -94,7 +94,7 @@ public class AccountAttributionInfoServiceImpl extends ServiceImpl<AccountAttrib
         List<AccountAttributionInfo>accountAttributionInfos = getAccountInfoList(userId,mediaType);
         Map<Long,Long> projectIdMaps = new HashMap<>();
         for(AccountAttributionInfo attributionInfo:accountAttributionInfos){
-            if(null!=attributionInfo.getProjectId()&&attributionInfo.getProjectId()!=0){
+            if(null!=attributionInfo&&null!=attributionInfo.getProjectId()&&attributionInfo.getProjectId()!=0){
                 projectIdMaps.putIfAbsent(attributionInfo.getProjectId(),attributionInfo.getProjectId());
             }
         }
@@ -120,7 +120,7 @@ public class AccountAttributionInfoServiceImpl extends ServiceImpl<AccountAttrib
     private List<AccountAttributionInfo> getAccountInfoListByProjectId(Long projectId, List<AccountAttributionInfo> accountAttributionInfos) {
         List<AccountAttributionInfo>result = new ArrayList<>();
         for(AccountAttributionInfo attributionInfo:accountAttributionInfos){
-            if(null!=attributionInfo.getProjectId()&&attributionInfo.getProjectId().equals(projectId)){
+            if(null!=attributionInfo&&null!=attributionInfo.getProjectId()&&attributionInfo.getProjectId().equals(projectId)){
                 result.add(attributionInfo);
             }
         }
@@ -204,17 +204,22 @@ public class AccountAttributionInfoServiceImpl extends ServiceImpl<AccountAttrib
         Map<String, Object> result = new HashMap<>();
         JSONObject after;
         JSONObject before;
-        if (startDate.equals(endDate)) {
-            after = accountAttributionInfoMapper.queryTodaySumReportBy(startDate, accounts);
+        Long startDateNum = Long.parseLong(startDate.replace("-",""));
+        Long anotherStartDateNum = Long.parseLong(DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1).replace("-",""));
+
+        Long endDateNum = Long.parseLong(endDate.replace("-",""));
+        Long anotherEndDateNum = Long.parseLong(DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, endDate, -1).replace("-",""));
+        if (startDateNum.equals(endDateNum)) {
+            after = accountAttributionInfoMapper.queryTodaySumReportBy(startDateNum, accounts);
             if (after == null) {
                 return result;
             }
-            before = accountAttributionInfoMapper.queryTodaySumByHour(DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), after.getInteger("maxHour"), accounts);
+            before = accountAttributionInfoMapper.queryTodaySumByHour(anotherStartDateNum, after.getInteger("maxHour"), accounts);
             if (before == null) {
                 before = after;
             }
         } else {
-            after = accountAttributionInfoMapper.querySumByStartEndDate(endDate, startDate, accounts);
+            after = accountAttributionInfoMapper.querySumByStartEndDate(endDateNum, startDateNum, accounts);
             if (after == null) {
                 return result;
             }
@@ -228,9 +233,14 @@ public class AccountAttributionInfoServiceImpl extends ServiceImpl<AccountAttrib
     public List<JSONObject> getChartDataBy(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate) throws ParseException {
         List<JSONObject> result = new ArrayList<>();
         String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapKs());
-        if (startDate.equals(endDate)) {
-            List<JSONObject> after = accountAttributionInfoMapper.queryTodayDetailReportBy(filedAll, startDate, accounts);
-            List<JSONObject> before = accountAttributionInfoMapper.queryTodayDetailReportBy(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), accounts);
+        Long startDateNum = Long.parseLong(startDate.replace("-",""));
+        Long anotherStartDateNum = Long.parseLong(DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1).replace("-",""));
+
+        Long endDateNum = Long.parseLong(endDate.replace("-",""));
+        Long anotherEndDateNum = Long.parseLong(DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, endDate, -1).replace("-",""));
+        if (startDateNum.equals(endDateNum)) {
+            List<JSONObject> after = accountAttributionInfoMapper.queryTodayDetailReportBy(filedAll, startDateNum, accounts);
+            List<JSONObject> before = accountAttributionInfoMapper.queryTodayDetailReportBy(filedAll, anotherStartDateNum, accounts);
             if (after.size() == 0) {
                 return result;
             }
@@ -244,9 +254,9 @@ public class AccountAttributionInfoServiceImpl extends ServiceImpl<AccountAttrib
             List<JSONObject> after;
             //判断是不是日期间隔大于半年
             if (DateUtils.isMoreSixMonth(startDate, endDate)) {
-                after = accountAttributionInfoMapper.queryDetailGroupMonthByDate(endDate, startDate, accounts);
+                after = accountAttributionInfoMapper.queryDetailGroupMonthByDate(endDateNum, startDateNum, accounts);
             } else {
-                after = accountAttributionInfoMapper.queryDetailByStartEndDate(endDate, startDate, accounts);
+                after = accountAttributionInfoMapper.queryDetailByStartEndDate(endDateNum, startDateNum, accounts);
             }
             if (after == null) {
                 return result;

+ 15 - 9
jeecg-boot-report/src/main/java/cn/com/ctop/report/service/impl/KuaishouAccountReportDailyDwServiceImpl.java

@@ -31,19 +31,25 @@ public class KuaishouAccountReportDailyDwServiceImpl extends ServiceImpl<Kuaisho
     public List<JSONObject> getListDataByParams(String mediaId, BigDecimal discount, JSONArray accounts, String startDate, String endDate, int hour, String target, String order) {
         List<JSONObject> result;
         String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.getDicMapKs());
-        if (startDate.equals(endDate)) {
+        Long startDateNum = Long.parseLong(startDate.replace("-",""));
+        Long anotherStartDateNum = Long.parseLong(DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1).replace("-",""));
+
+        Long endDateNum = Long.parseLong(endDate.replace("-",""));
+        Long anotherEndDateNum = Long.parseLong(DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, endDate, -1).replace("-",""));
+
+        if (startDateNum.equals(endDateNum)) {
             String groupBy = "account_id";
             if (startDate.equals(DateUtils.date2Str())) {
-                result = kuaishouAccountReportHourlyDwMapper.getReportByParams(filedAll, startDate, hour, accounts, target, order,1,groupBy);
-                JSONObject afterSum = kuaishouAccountReportHourlyDwMapper.getReportByParams(filedAll, startDate, hour, accounts,target,order,0,groupBy).get(0);
-                JSONObject beforeSum = kuaishouAccountReportHourlyDwMapper.getReportByParams(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), hour, accounts,target,order,0,groupBy).get(0);
+                result = kuaishouAccountReportHourlyDwMapper.getReportByParams(filedAll, startDateNum, hour, accounts, target, order,1,groupBy);
+                JSONObject afterSum = kuaishouAccountReportHourlyDwMapper.getReportByParams(filedAll, startDateNum, hour, accounts,target,order,0,groupBy).get(0);
+                JSONObject beforeSum = kuaishouAccountReportHourlyDwMapper.getReportByParams(filedAll,anotherStartDateNum , hour, accounts,target,order,0,groupBy).get(0);
                 result.add(afterSum);
                 result.add(beforeSum);
                 result.add(countTotal(afterSum, beforeSum));
             } else {
-                result = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDate, startDate, accounts, target, order,1,groupBy);
-                JSONObject afterSum = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDate, startDate, accounts,target,order,0,groupBy).get(0);
-                JSONObject beforeSum = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, endDate, -1), DateUtils.getAnotherDay(SystemDateConstant.yyyy_MM_dd, startDate, -1), accounts,target,order,0,groupBy).get(0);
+                result = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDateNum, startDateNum, accounts, target, order,1,groupBy);
+                JSONObject afterSum = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDateNum, startDateNum, accounts,target,order,0,groupBy).get(0);
+                JSONObject beforeSum = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, anotherEndDateNum, anotherStartDateNum, accounts,target,order,0,groupBy).get(0);
                 result.add(afterSum);
                 result.add(beforeSum);
                 result.add(countTotal(afterSum, beforeSum));
@@ -53,8 +59,8 @@ public class KuaishouAccountReportDailyDwServiceImpl extends ServiceImpl<Kuaisho
             if (accounts.size() > 1) {
                 groupBy = "account_id";
             }
-            result = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDate, startDate, accounts, target, order,1,groupBy);
-            List<JSONObject> totalList = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDate, startDate, accounts,target,order,0,groupBy);
+            result = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDateNum, startDateNum, accounts, target, order,1,groupBy);
+            List<JSONObject> totalList = kuaishouAccountReportDailyDwMapper.getReportByParams(filedAll, endDateNum, startDateNum, accounts,target,order,0,groupBy);
             if(null!=totalList&&!totalList.isEmpty()){
                 result.add(totalList.get(0));
             }

+ 3 - 3
jeecg-boot-report/src/main/resources/application-dev.yml

@@ -105,9 +105,9 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://192.168.1.187:4000/application?characterEncoding=UTF-8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
-          username: root
-          password: hcst2021
+          url: jdbc:mysql://139.186.27.96:3390/application?characterEncoding=UTF-8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          username: data
+          password: hcst@2021
           driver-class-name: com.mysql.jdbc.Driver
   #redis 配置
   redis:

+ 1 - 1
jeecg-boot-report/src/main/resources/application-prod.yml

@@ -105,7 +105,7 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:mysql://139.186.27.96:3390/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          url: jdbc:mysql://139.186.27.96:3390/application?characterEncoding=UTF-8&useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
           username: data
           password: hcst@2021
           driver-class-name: com.mysql.jdbc.Driver

+ 1 - 1
jeecg-cloud-module/jeecg-cloud-gateway/src/main/resources/application-dev.yml

@@ -38,7 +38,7 @@ spring:
           - Path=/bytedance/ad/**
         filters:
           - DedupeResponseHeader=Access-Control-Allow-Credentials Access-Control-Allow-Origin
-      - id: jeecg-bytedance-ad
+      - id: jeecg-cloud-report
         uri: lb://jeecg-cloud-report
         predicates:
           - Path=/reportModule/**

+ 6 - 0
jeecg-cloud-module/jeecg-cloud-gateway/src/main/resources/application-prod.yml

@@ -50,6 +50,12 @@ spring:
           - DedupeResponseHeader=Access-Control-Allow-Credentials Access-Control-Allow-Origin
         predicates:
           - Path=/finance/**
+      - id: jeecg-cloud-report
+        uri: lb://jeecg-cloud-report
+        predicates:
+          - Path=/reportModule/**
+        filters:
+          - DedupeResponseHeader=Access-Control-Allow-Credentials Access-Control-Allow-Origin
 # hystrix 信号量隔离,3秒后自动超时
 hystrix:
   enabled: true