Browse Source

Merge branch 'enquiry_report' of wangfan/adweb3-server into master

wangfan 4 months ago
parent
commit
e6497a1f60

+ 2 - 2
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/mapper/xml/GACountryReportMapper.xml

@@ -5,13 +5,13 @@
     <select id="getCountryStats" resultType="org.jeecg.modules.adweb.dmp.vo.report.CountryStatsVO">
         SELECT
         t1.*,
-        LOWER(t2.country_iso_code) country_code,
+        LOWER(t2.country_iso_code) AS country_code,
         t2.country_name
         FROM
         (
         SELECT
         country,
-        SUM(total_users) `total_users`
+        SUM(total_users) AS total_users
         FROM
         dmp_ga_country_report
         WHERE

+ 3 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/dmp/service/impl/EnquiryReportServiceImpl.java

@@ -40,12 +40,12 @@ public class EnquiryReportServiceImpl implements IEnquiryReportService {
         }
 
         // 1. 时间区间内所有国家enquires总数
-        int totalEnquires =
+        int enquiresSum =
                 enquiryCountryStatsVOs.stream().mapToInt(EnquiryCountryStatsVO::getEnquires).sum();
 
         // 2. VO数据填充
         for (EnquiryCountryStatsVO enquiryCountryStatsVO : enquiryCountryStatsVOs) {
-            // adweb_country表无记录时,如EnquiryCountryStatsVO.countryCode为空
+            // adweb_country表无记录时,如EnquiryCountryStatsVO.countryCode为空或无效
             if (StringUtils.isBlank(enquiryCountryStatsVO.getCountry())
                     || StringUtils.isBlank(enquiryCountryStatsVO.getCountryName())) {
                 enquiryCountryStatsVO.setCountry(enquiryCountryStatsVO.getCountryCode());
@@ -54,8 +54,7 @@ public class EnquiryReportServiceImpl implements IEnquiryReportService {
 
             enquiryCountryStatsVO.setEnquiresProportion(
                     NumberUtil.formatPercentage(
-                            NumberUtil.safeDivide(
-                                    enquiryCountryStatsVO.getEnquires(), totalEnquires),
+                            NumberUtil.safeDivide(enquiryCountryStatsVO.getEnquires(), enquiresSum),
                             2));
         }
 

+ 4 - 4
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/enquiry/mapper/xml/AdwebEnquiryMapper.xml

@@ -306,7 +306,7 @@
 
     <select id="getEnquiryDailyCounts" resultType="org.apache.commons.lang3.tuple.ImmutableTriple">
         SELECT
-        DATE_FORMAT(record_ctime, '%Y-%m-%d') AS `date`,
+        DATE_FORMAT(record_ctime, '%Y-%m-%d') AS date,
         COUNT(id) AS enquires,
         COUNT(CASE WHEN read_status = 0 THEN 1 END) AS unread
         FROM
@@ -363,14 +363,14 @@
     <select id="getEnquiryCountryStats" resultType="org.jeecg.modules.adweb.dmp.vo.report.EnquiryCountryStatsVO">
         SELECT
         t1.enquires,
-        LOWER(t1.country_code) country_code,
-        t2.country_name_en country,
+        LOWER(t1.country_code) AS country_code,
+        t2.country_name_en AS country,
         t2.country_name
         FROM
         (
         SELECT
         country_code,
-        COUNT(1) enquires
+        COUNT(1) AS enquires
         FROM
         adweb_enquiry
         WHERE