Преглед изворни кода

Merge branch 'master' into site-manage

chenlei1231 пре 5 месеци
родитељ
комит
c0b887cc8a
15 измењених фајлова са 385 додато и 8 уклоњено
  1. 27 3
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/common/util/RestTemplateUtil.java
  2. 34 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/ResourceDTO.java
  3. 16 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/analytics/CreatePropertyRequestDTO.java
  4. 29 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/analytics/GAAccountDTO.java
  5. 26 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/analytics/GADataStreamDTO.java
  6. 47 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/analytics/GAPropertyDTO.java
  7. 16 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/gtm/CreateContainerRequestDTO.java
  8. 26 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/gtm/GTMAccountDTO.java
  9. 45 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/gtm/GTMContainerDTO.java
  10. 32 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/gtm/GTMTriggerDTO.java
  11. 30 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/gtm/GTMVersionDTO.java
  12. 28 0
      jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/gtm/GTMWorkspaceDTO.java
  13. 10 2
      jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml
  14. 9 1
      jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml
  15. 10 2
      jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml

+ 27 - 3
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/common/util/RestTemplateUtil.java

@@ -3,8 +3,10 @@ package org.jeecg.modules.adweb.common.util;
 import lombok.extern.slf4j.Slf4j;
 
 import org.apache.commons.codec.binary.Base64;
-import org.springframework.http.HttpHeaders;
+import org.springframework.core.ParameterizedTypeReference;
+import org.springframework.http.*;
 import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.web.client.RestClientException;
 import org.springframework.web.client.RestTemplate;
 
 import java.nio.charset.StandardCharsets;
@@ -13,6 +15,8 @@ import java.util.Map;
 /**
  * {@link RestTemplate}初始化及工厂类
  *
+ * <p>普通文本类型HTTP请求,请使用{@link org.jeecg.common.util.RestUtil}
+ *
  * @author wfansh
  */
 @Slf4j
@@ -43,7 +47,26 @@ public class RestTemplateUtil {
                 Map.of(HttpHeaders.AUTHORIZATION, "Basic " + new String(encodedAuth)));
     }
 
-    public static RestTemplate getRestTemplate(
+    /** HTTP POST请求读取对象 */
+    public static <T> T postForObject(
+            RestTemplate restTemplate,
+            String url,
+            Object request,
+            ParameterizedTypeReference<T> responseType)
+            throws RestClientException {
+        RequestEntity<?> requestEntity = RequestEntity.post(url).body(request);
+        return restTemplate.exchange(requestEntity, responseType).getBody();
+    }
+
+    /** HTTP GET请求读取对象 */
+    public static <T> T getForObject(
+            RestTemplate restTemplate, String url, ParameterizedTypeReference<T> responseType)
+            throws RestClientException {
+        RequestEntity<?> requestEntity = RequestEntity.get(url).build();
+        return restTemplate.exchange(requestEntity, responseType).getBody();
+    }
+
+    private static RestTemplate getRestTemplate(
             int connectTimeoutSeconds, int readTimeoutSeconds, Map<String, String> httpHeaders) {
         // 1. 请求超时
         SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
@@ -57,7 +80,8 @@ public class RestTemplateUtil {
                 .getInterceptors()
                 .add(
                         ((request, body, execution) -> {
-                            httpHeaders.entrySet().stream()
+                            httpHeaders
+                                    .entrySet()
                                     .forEach(
                                             entry ->
                                                     request.getHeaders()

+ 34 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/ResourceDTO.java

@@ -0,0 +1,34 @@
+package org.jeecg.modules.adweb.databridge.dto.google;
+
+import com.google.common.base.Splitter;
+import com.google.common.collect.Iterables;
+
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.SuperBuilder;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author wfansh
+ */
+@Data
+@SuperBuilder
+@NoArgsConstructor
+public abstract class ResourceDTO implements Serializable {
+
+    protected static final char RESOURCE_NAME_SPLITTER = '/';
+
+    private String id;
+
+    private String resourceName;
+
+    private String displayName;
+
+    /** Parses ID from the resource name. */
+    public static String parseId(String resourceName) {
+        List<String> parts = Splitter.on(RESOURCE_NAME_SPLITTER).splitToList(resourceName);
+        return parts.isEmpty() ? null : Iterables.getLast(parts);
+    }
+}

+ 16 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/analytics/CreatePropertyRequestDTO.java

@@ -0,0 +1,16 @@
+package org.jeecg.modules.adweb.databridge.dto.google.analytics;
+
+import lombok.Data;
+
+/**
+ * @author wfansh
+ */
+@Data
+public class CreatePropertyRequestDTO {
+
+    private String accountResourceName;
+
+    private String displayName;
+
+    private String url;
+}

+ 29 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/analytics/GAAccountDTO.java

@@ -0,0 +1,29 @@
+package org.jeecg.modules.adweb.databridge.dto.google.analytics;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.SuperBuilder;
+
+import org.apache.commons.lang3.StringUtils;
+import org.jeecg.modules.adweb.databridge.dto.google.ResourceDTO;
+
+/**
+ * @author wfansh
+ */
+@Data
+@SuperBuilder
+@NoArgsConstructor
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+public class GAAccountDTO extends ResourceDTO {
+
+    private long createTime;
+
+    private long updateTime;
+
+    public static String toResourceName(String id) {
+        return StringUtils.isNumeric(id) ? "accounts" + RESOURCE_NAME_SPLITTER + id : id;
+    }
+}

+ 26 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/analytics/GADataStreamDTO.java

@@ -0,0 +1,26 @@
+package org.jeecg.modules.adweb.databridge.dto.google.analytics;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.SuperBuilder;
+
+import org.jeecg.modules.adweb.databridge.dto.google.ResourceDTO;
+
+/**
+ * @author wfansh
+ */
+@Data
+@SuperBuilder
+@NoArgsConstructor
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+public class GADataStreamDTO extends ResourceDTO {
+
+    private String propertyResourceName;
+
+    private String streamMeasurementId;
+
+    private String streamDefaultUrl;
+}

+ 47 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/analytics/GAPropertyDTO.java

@@ -0,0 +1,47 @@
+package org.jeecg.modules.adweb.databridge.dto.google.analytics;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.SuperBuilder;
+
+import org.apache.commons.lang3.StringUtils;
+import org.jeecg.modules.adweb.databridge.dto.google.ResourceDTO;
+
+import java.util.List;
+
+/**
+ * @author wfansh
+ */
+@Data
+@SuperBuilder
+@NoArgsConstructor
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+public class GAPropertyDTO extends ResourceDTO {
+
+    private String propertyType;
+
+    private String accountResourceName;
+
+    private String parentResourceName;
+
+    private String industryCategory;
+
+    private String timeZone;
+
+    private String currencyCode;
+
+    private String serviceLevel;
+
+    private long createTime;
+
+    private long updateTime;
+
+    private List<GADataStreamDTO> dataStreams;
+
+    public static String toResourceName(String id) {
+        return StringUtils.isNumeric(id) ? "properties" + RESOURCE_NAME_SPLITTER + id : id;
+    }
+}

+ 16 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/gtm/CreateContainerRequestDTO.java

@@ -0,0 +1,16 @@
+package org.jeecg.modules.adweb.databridge.dto.google.gtm;
+
+import lombok.Data;
+
+/**
+ * @author wfansh
+ */
+@Data
+public class CreateContainerRequestDTO {
+
+    private String accountResourceName;
+
+    private String displayName;
+
+    private String googleTagId;
+}

+ 26 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/gtm/GTMAccountDTO.java

@@ -0,0 +1,26 @@
+package org.jeecg.modules.adweb.databridge.dto.google.gtm;
+
+import lombok.*;
+import lombok.experimental.SuperBuilder;
+
+import org.apache.commons.lang3.StringUtils;
+import org.jeecg.modules.adweb.databridge.dto.google.ResourceDTO;
+
+/**
+ * @author wfansh
+ */
+@Data
+@SuperBuilder
+@NoArgsConstructor
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+public class GTMAccountDTO extends ResourceDTO {
+
+    private boolean supportUserPermissions;
+
+    private boolean supportMultipleContainers;
+
+    public static String toResourceName(String id) {
+        return StringUtils.isNumeric(id) ? "accounts" + RESOURCE_NAME_SPLITTER + id : id;
+    }
+}

+ 45 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/gtm/GTMContainerDTO.java

@@ -0,0 +1,45 @@
+package org.jeecg.modules.adweb.databridge.dto.google.gtm;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.SuperBuilder;
+
+import org.apache.commons.lang3.StringUtils;
+import org.jeecg.modules.adweb.databridge.dto.google.ResourceDTO;
+
+import java.util.List;
+
+/**
+ * @author wfansh
+ */
+@Data
+@SuperBuilder
+@NoArgsConstructor
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+public class GTMContainerDTO extends ResourceDTO {
+
+    private String accountId;
+
+    private List<String> domainNames;
+
+    private String publicId;
+
+    private List<String> tagIds;
+
+    private String notes;
+
+    private List<String> usageContext;
+
+    private String headSnippet;
+
+    private String bodySnippet;
+
+    private String fingerprint;
+
+    public static String toResourceName(String id) {
+        return StringUtils.isNumeric(id) ? "accounts" + RESOURCE_NAME_SPLITTER + id : id;
+    }
+}

+ 32 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/gtm/GTMTriggerDTO.java

@@ -0,0 +1,32 @@
+package org.jeecg.modules.adweb.databridge.dto.google.gtm;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.SuperBuilder;
+
+import org.jeecg.modules.adweb.databridge.dto.google.ResourceDTO;
+
+/**
+ * @author wfansh
+ */
+@Data
+@SuperBuilder
+@NoArgsConstructor
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+public class GTMTriggerDTO extends ResourceDTO {
+
+    private String accountId;
+
+    private String containerId;
+
+    private String workspaceId;
+
+    private String type;
+
+    private String notes;
+
+    private String fingerprint;
+}

+ 30 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/gtm/GTMVersionDTO.java

@@ -0,0 +1,30 @@
+package org.jeecg.modules.adweb.databridge.dto.google.gtm;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.SuperBuilder;
+
+import org.jeecg.modules.adweb.databridge.dto.google.ResourceDTO;
+
+/**
+ * @author wfansh
+ */
+@Data
+@SuperBuilder
+@NoArgsConstructor
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+public class GTMVersionDTO extends ResourceDTO {
+
+    private String accountId;
+
+    private String containerId;
+
+    private boolean deleted;
+
+    private String description;
+
+    private String fingerprint;
+}

+ 28 - 0
jeecg-module-system/jeecg-system-biz/src/main/java/org/jeecg/modules/adweb/databridge/dto/google/gtm/GTMWorkspaceDTO.java

@@ -0,0 +1,28 @@
+package org.jeecg.modules.adweb.databridge.dto.google.gtm;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.SuperBuilder;
+
+import org.jeecg.modules.adweb.databridge.dto.google.ResourceDTO;
+
+/**
+ * @author wfansh
+ */
+@Data
+@SuperBuilder
+@NoArgsConstructor
+@ToString(callSuper = true)
+@EqualsAndHashCode(callSuper = true)
+public class GTMWorkspaceDTO extends ResourceDTO {
+
+    private String accountId;
+
+    private String containerId;
+
+    private String description;
+
+    private String fingerprint;
+}

+ 10 - 2
jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml

@@ -246,7 +246,7 @@ jeecg:
   #大屏报表参数设置
   jmreport:
     #多租户模式,默认值为空(created:按照创建人隔离、tenant:按照租户隔离) (v1.6.2+ 新增)
-    saasMode: 
+    saasMode:
     # 平台上线安全配置(v1.6.2+ 新增)
     firewall:
       # 数据源安全 (开启后,不允许使用平台数据源、SQL解析加签并且不允许查询数据库)
@@ -334,4 +334,12 @@ security:
       ignore-urls:
         - /test/jeecgDemo/demo3
         - /test/jeecgDemo/redisDemo/**
-        - /jmreport/bigscreen2/**
+        - /jmreport/bigscreen2/**
+
+### 自定义
+### GA,GTM,Ads等数据交换中心
+data-bridge:
+  open:
+    api:
+      host: http://data-bridge.v3.adwebcloud.com:9002
+      token: lgoXX9APqgPLGMPECiNoxaPx

+ 9 - 1
jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml

@@ -322,4 +322,12 @@ security:
         - /test/jeecgDemo/demo3
         - /test/jeecgDemo/redisDemo/**
         - /jmreport/bigscreen2/**
-        - /api/getUserInfo
+        - /api/getUserInfo
+
+### 自定义
+### GA,GTM,Ads等数据交换中心
+data-bridge:
+  open:
+    api:
+      host: http://data-bridge.v3.adwebcloud.com:9002
+      token: lgoXX9APqgPLGMPECiNoxaPx

+ 10 - 2
jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml

@@ -246,7 +246,7 @@ jeecg:
   #大屏报表参数设置
   jmreport:
     #多租户模式,默认值为空(created:按照创建人隔离、tenant:按照租户隔离) (v1.6.2+ 新增)
-    saasMode: 
+    saasMode:
     # 平台上线安全配置(v1.6.2+ 新增)
     firewall:
       # 数据源安全 (开启后,不允许使用平台数据源、SQL解析加签并且不允许查询数据库)
@@ -320,4 +320,12 @@ security:
       ignore-urls:
         - /test/jeecgDemo/demo3
         - /test/jeecgDemo/redisDemo/**
-        - /jmreport/bigscreen2/**
+        - /jmreport/bigscreen2/**
+
+### 自定义
+### GA,GTM,Ads等数据交换中心
+data-bridge:
+  open:
+    api:
+      host: http://data-bridge.v3.adwebcloud.com:9002
+      token: lgoXX9APqgPLGMPECiNoxaPx