Ver Fonte

Reformat

wfansh há 6 meses atrás
pai
commit
c7573ac7a7

+ 2 - 2
src/main/java/com/wechi/adweb/bridge/google/analytics/controller/GAController.java

@@ -62,7 +62,7 @@ public class GAController extends BaseController {
         long start = System.currentTimeMillis();
         log.info("****** listGAProperties() ****** apiRequest = {}", JsonUtils.toJson(apiRequest));
 
-        // 1. Validates request parameters - GA account resource name.
+        // 1. Validates the request parameters - GA account resource name.
         if (StringUtils.isEmpty(apiRequest.getData())) {
             throw new BadRequestException(apiRequest);
         }
@@ -88,7 +88,7 @@ public class GAController extends BaseController {
         log.info("****** getGAReport() ****** apiRequest = {}", JsonUtils.toJson(apiRequest));
         GAReportRequestDTO reportRequest = apiRequest.getData();
 
-        // 1. Validates request parameters.
+        // 1. Validates the request parameters.
         if (Objects.isNull(reportRequest)
                 || StringUtils.isEmpty(reportRequest.getPropertyResourceName())
                 || Objects.isNull(reportRequest.getReportType())

+ 0 - 5
src/main/java/com/wechi/adweb/bridge/google/analytics/dto/report/GAReportRequestDTO.java

@@ -32,9 +32,4 @@ public class GAReportRequestDTO {
 
     /** Use default values in {@link ReportType} instead. */
     @Deprecated private Boolean orderByDesc;
-
-    public enum OrderByType {
-        METRICS,
-        DIMENSIONS
-    }
 }

+ 9 - 0
src/main/java/com/wechi/adweb/bridge/google/analytics/dto/report/OrderByType.java

@@ -0,0 +1,9 @@
+package com.wechi.adweb.bridge.google.analytics.dto.report;
+
+/**
+ * @author wfansh
+ */
+public enum OrderByType {
+    METRICS,
+    DIMENSIONS
+}

+ 3 - 3
src/main/java/com/wechi/adweb/bridge/google/analytics/dto/report/ReportType.java

@@ -1,6 +1,6 @@
 package com.wechi.adweb.bridge.google.analytics.dto.report;
 
-import static com.wechi.adweb.bridge.google.analytics.dto.report.GAReportRequestDTO.OrderByType.*;
+import static com.wechi.adweb.bridge.google.analytics.dto.report.OrderByType.*;
 import static com.wechi.adweb.bridge.google.analytics.dto.report.ReportConstant.*;
 
 import lombok.Getter;
@@ -63,7 +63,7 @@ public enum ReportType {
             List<String> defaultMetrics,
             List<String> defaultDimensions,
             String defaultOrderBy,
-            GAReportRequestDTO.OrderByType defaultOrderByType,
+            OrderByType defaultOrderByType,
             boolean defaultOrderByDesc) {
         this.defaultMetrics = defaultMetrics;
         this.defaultDimensions = defaultDimensions;
@@ -75,6 +75,6 @@ public enum ReportType {
     private final List<String> defaultMetrics;
     private final List<String> defaultDimensions;
     private final String defaultOrderBy;
-    private final GAReportRequestDTO.OrderByType defaultOrderByType;
+    private final OrderByType defaultOrderByType;
     private final Boolean defaultOrderByDesc;
 }

+ 1 - 0
src/main/java/com/wechi/adweb/bridge/google/analytics/dto/report/data/CountryChartData.java

@@ -15,6 +15,7 @@ import java.util.List;
 @Data
 @Builder
 public class CountryChartData implements GAReportDataDTO {
+
     private String country;
     private int totalUsers;
 

+ 1 - 0
src/main/java/com/wechi/adweb/bridge/google/analytics/dto/report/data/DateViewData.java

@@ -19,6 +19,7 @@ import java.util.List;
 @Data
 @Builder
 public class DateViewData implements GAReportDataDTO {
+
     /**
      * Formatted as {@link DateTimeFormatter#ISO_LOCAL_DATE}, originated from {@link
      * DateTimeFormatter#BASIC_ISO_DATE}

+ 1 - 0
src/main/java/com/wechi/adweb/bridge/google/analytics/dto/report/data/SourceMediaViewData.java

@@ -17,6 +17,7 @@ import java.util.List;
 @Data
 @Builder
 public class SourceMediaViewData implements GAReportDataDTO {
+
     private String type;
 
     private int totalUsers;

+ 2 - 3
src/main/java/com/wechi/adweb/bridge/google/analytics/service/GADataService.java

@@ -1,16 +1,15 @@
 package com.wechi.adweb.bridge.google.analytics.service;
 
-import static com.wechi.adweb.bridge.google.analytics.dto.report.GAReportRequestDTO.*;
-
 import com.google.analytics.data.v1beta.*;
 import com.google.api.gax.core.FixedCredentialsProvider;
 import com.google.auth.oauth2.GoogleCredentials;
 import com.wechi.adweb.bridge.exception.DataException;
 import com.wechi.adweb.bridge.google.analytics.dto.report.GAReportRequestDTO;
+import com.wechi.adweb.bridge.google.analytics.dto.report.OrderByType;
 import com.wechi.adweb.bridge.google.analytics.dto.report.ReportType;
 import com.wechi.adweb.bridge.google.analytics.dto.report.data.*;
-
 import com.wechi.adweb.bridge.util.JsonUtils;
+
 import lombok.extern.slf4j.Slf4j;
 
 import org.apache.commons.lang3.BooleanUtils;