From 8c761b4e946f32a338289b8b11df9a4d1738a7f2 Mon Sep 17 00:00:00 2001
From: qyx <565485304@qq.com>
Date: Fri, 5 Nov 2021 16:31:55 +0800
Subject: [PATCH] =?UTF-8?q?[=E6=96=B0=E5=A2=9E=E5=8A=9F=E8=83=BD](master):?=
=?UTF-8?q?=20=E5=88=9D=E5=A7=8B=E5=8C=96=E5=B7=A5=E7=A8=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
对整个工程模块进行了搭建和区分;
---
.gitignore | 46 +++++++
README.md | 21 ++++
ad-platform-callback/.gitignore | 46 +++++++
ad-platform-callback/README.md | 0
ad-platform-callback/pom.xml | 39 ++++++
.../baiye/AdPlatformCallbackApplication.java | 15 +++
.../java/com/baiye/api/JuLiangOpenAPi.java | 4 +
.../baiye/constant/CallBackCommonTags.java | 17 +++
.../constant/CallbackAddressConstant.java | 21 ++++
ad-platform-common/.gitignore | 46 +++++++
ad-platform-common/pom.xml | 31 +++++
.../java/com/baiye/http/CommonResponse.java | 117 ++++++++++++++++++
.../java/com/baiye/http/ResponseCode.java | 54 ++++++++
ad-platform-service/.gitignore | 46 +++++++
ad-platform-service/pom.xml | 46 +++++++
.../baiye/AdPlatformServiceApplication.java | 15 +++
.../api/AdPlatformAddressController.java | 12 ++
pom.xml | 46 +++++++
18 files changed, 622 insertions(+)
create mode 100644 .gitignore
create mode 100644 README.md
create mode 100644 ad-platform-callback/.gitignore
create mode 100644 ad-platform-callback/README.md
create mode 100644 ad-platform-callback/pom.xml
create mode 100644 ad-platform-callback/src/main/java/com/baiye/AdPlatformCallbackApplication.java
create mode 100644 ad-platform-callback/src/main/java/com/baiye/api/JuLiangOpenAPi.java
create mode 100644 ad-platform-callback/src/main/java/com/baiye/constant/CallBackCommonTags.java
create mode 100644 ad-platform-callback/src/main/java/com/baiye/constant/CallbackAddressConstant.java
create mode 100644 ad-platform-common/.gitignore
create mode 100644 ad-platform-common/pom.xml
create mode 100644 ad-platform-common/src/main/java/com/baiye/http/CommonResponse.java
create mode 100644 ad-platform-common/src/main/java/com/baiye/http/ResponseCode.java
create mode 100644 ad-platform-service/.gitignore
create mode 100644 ad-platform-service/pom.xml
create mode 100644 ad-platform-service/src/main/java/com/baiye/AdPlatformServiceApplication.java
create mode 100644 ad-platform-service/src/main/java/com/baiye/api/AdPlatformAddressController.java
create mode 100644 pom.xml
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..efb4aab2
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,46 @@
+### Java template
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+### Maven template
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+# https://github.com/takari/maven-wrapper#usage-without-binary-jar
+.mvn/wrapper/maven-wrapper.jar
+
+### Example user template template
+### Example user template
+
+# IntelliJ project files
+.idea
+*.iml
+out
+gen
diff --git a/README.md b/README.md
new file mode 100644
index 00000000..167c8a92
--- /dev/null
+++ b/README.md
@@ -0,0 +1,21 @@
+
百业广告平台业务系统 v0.0.1
+
+## 0. 主要功能设计
+ ad-platform-callback
+ 设计回调处理,对头条广告投放平台,百度广告投放平台,广点通投放平台的广告点击进行检测
+ ad-platform-service
+ 对进行整理后的点击数据对外提供查询接口服务
+ ad-platform-common
+ 通用的工具及pojo包
+
+## 1. 核心链路
+ 配置回调地址及参数 -> 检测回调结果进行入库 -> 提供接口进行查询 -> 导出查询后的结果
+
+## 2. 涉及核心技术及框架
+ 储存中间件 : 分表分库(ShardingJDBC)
+ 框架技术选型 : SpringBoot , JPA
+ 数据存储选型 : Mysql , ES
+ 中间件: RocketMQ, 缓存, Canal
+
+
+
\ No newline at end of file
diff --git a/ad-platform-callback/.gitignore b/ad-platform-callback/.gitignore
new file mode 100644
index 00000000..efb4aab2
--- /dev/null
+++ b/ad-platform-callback/.gitignore
@@ -0,0 +1,46 @@
+### Java template
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+### Maven template
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+# https://github.com/takari/maven-wrapper#usage-without-binary-jar
+.mvn/wrapper/maven-wrapper.jar
+
+### Example user template template
+### Example user template
+
+# IntelliJ project files
+.idea
+*.iml
+out
+gen
diff --git a/ad-platform-callback/README.md b/ad-platform-callback/README.md
new file mode 100644
index 00000000..e69de29b
diff --git a/ad-platform-callback/pom.xml b/ad-platform-callback/pom.xml
new file mode 100644
index 00000000..0f383022
--- /dev/null
+++ b/ad-platform-callback/pom.xml
@@ -0,0 +1,39 @@
+
+
+
+ ad-platform
+ com.baiye
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ ad-platform-callback
+
+
+ 8
+ 8
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+
+
+ org.apache.commons
+ commons-lang3
+
+
+
+ cn.hutool
+ hutool-all
+
+
+
+
+
\ No newline at end of file
diff --git a/ad-platform-callback/src/main/java/com/baiye/AdPlatformCallbackApplication.java b/ad-platform-callback/src/main/java/com/baiye/AdPlatformCallbackApplication.java
new file mode 100644
index 00000000..1a6e26a2
--- /dev/null
+++ b/ad-platform-callback/src/main/java/com/baiye/AdPlatformCallbackApplication.java
@@ -0,0 +1,15 @@
+package com.baiye;
+
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @author q
+ */
+@SpringBootApplication
+public class AdPlatformCallbackApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(AdPlatformCallbackApplication.class, args);
+ }
+}
diff --git a/ad-platform-callback/src/main/java/com/baiye/api/JuLiangOpenAPi.java b/ad-platform-callback/src/main/java/com/baiye/api/JuLiangOpenAPi.java
new file mode 100644
index 00000000..ccbf0d4d
--- /dev/null
+++ b/ad-platform-callback/src/main/java/com/baiye/api/JuLiangOpenAPi.java
@@ -0,0 +1,4 @@
+package com.baiye.api;
+
+public class JuLiangOpenAPi {
+}
diff --git a/ad-platform-callback/src/main/java/com/baiye/constant/CallBackCommonTags.java b/ad-platform-callback/src/main/java/com/baiye/constant/CallBackCommonTags.java
new file mode 100644
index 00000000..b3e3603f
--- /dev/null
+++ b/ad-platform-callback/src/main/java/com/baiye/constant/CallBackCommonTags.java
@@ -0,0 +1,17 @@
+package com.baiye.constant;
+
+/**
+ * 特殊可替换地址标识符
+ *
+ * @author q
+ */
+public class CallBackCommonTags {
+
+ public static String HOSTNAME_TAG = "^[hostname]";
+
+ public static String M_PLAT_TAG = "^[m_plat]";
+
+ public static String PRO_TYPE_TAG = "^[pro_type]";
+
+ public static String level = "^[level]";
+}
diff --git a/ad-platform-callback/src/main/java/com/baiye/constant/CallbackAddressConstant.java b/ad-platform-callback/src/main/java/com/baiye/constant/CallbackAddressConstant.java
new file mode 100644
index 00000000..4b22591c
--- /dev/null
+++ b/ad-platform-callback/src/main/java/com/baiye/constant/CallbackAddressConstant.java
@@ -0,0 +1,21 @@
+package com.baiye.constant;
+
+/**
+ * 回调地址设置
+ *
+ * @author q
+ */
+public class CallbackAddressConstant {
+
+
+ public static String TOUTIAO_ADD_ADDRESSS = "https://"
+ +CallBackCommonTags.HOSTNAME_TAG
+ +"/callbacks/oceanCallback?aid=__AID__&aid_name=__AID_NAME__&cid=__CID__&cid" +
+ "_name=__CID_NAME__&campaign_id=__CAMPAIGN_ID__&campaign_name=__CAMPAIGN_NAME__&c" +
+ "type=__CTYPE__&csite=__CSITE__&convert_id=__CONVERT_ID__&request_id=__REQUEST_ID__&sl=__SL" +
+ "__&imei=__IMEI__&idfa=__IDFA__&androidid=__ANDROIDID__&oaid=__OAID__&oaid_md5=__OAID_M" +
+ "D5__&os=__OS__&mac=__MAC__&mac1=__MAC1__&ip=__IP__&ua=__UA__&geo=__GEO__&TIMESTAMP" +
+ "=__TS__&callback=__CALLBACK_URL__&model=__MODEL__&union_site=__UNION_SITE__&caid1=__CAI\n" +
+ "D1__&m_plat=toutiao&pro_type=⼴告类型标识&level=⼴告点击层级";
+
+}
diff --git a/ad-platform-common/.gitignore b/ad-platform-common/.gitignore
new file mode 100644
index 00000000..efb4aab2
--- /dev/null
+++ b/ad-platform-common/.gitignore
@@ -0,0 +1,46 @@
+### Java template
+# Compiled class file
+*.class
+
+# Log file
+*.log
+
+# BlueJ files
+*.ctxt
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.nar
+*.ear
+*.zip
+*.tar.gz
+*.rar
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+### Maven template
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+# https://github.com/takari/maven-wrapper#usage-without-binary-jar
+.mvn/wrapper/maven-wrapper.jar
+
+### Example user template template
+### Example user template
+
+# IntelliJ project files
+.idea
+*.iml
+out
+gen
diff --git a/ad-platform-common/pom.xml b/ad-platform-common/pom.xml
new file mode 100644
index 00000000..953f6b3d
--- /dev/null
+++ b/ad-platform-common/pom.xml
@@ -0,0 +1,31 @@
+
+
+
+ ad-platform
+ com.baiye
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ ad-platform-common
+
+
+ 8
+ 8
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+
\ No newline at end of file
diff --git a/ad-platform-common/src/main/java/com/baiye/http/CommonResponse.java b/ad-platform-common/src/main/java/com/baiye/http/CommonResponse.java
new file mode 100644
index 00000000..5541cf09
--- /dev/null
+++ b/ad-platform-common/src/main/java/com/baiye/http/CommonResponse.java
@@ -0,0 +1,117 @@
+package com.baiye.http;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+
+
+/**
+ * 属性为 空("") 或者为 NULL 都不序列化,则返回的json是没有这个字段的。这样对移动端会更省流量
+ * @param
+ */
+@JsonSerialize
+@Getter
+@JsonInclude(JsonInclude.Include.NON_EMPTY)
+@NoArgsConstructor
+public class CommonResponse implements Serializable {
+
+ /**
+ * 成功还是失败的状态标识 0,成功 1,失败
+ */
+ private int status;
+
+ /**
+ * 返回信息
+ */
+ private String msg;
+
+ /**
+ * 返回的结果数据
+ */
+ private T data;
+
+
+ /*
+ 封装所有的构造器为私有的
+ */
+
+ private CommonResponse(int status) {
+ this.status = status;
+ }
+
+ private CommonResponse(int status, T data) { // ps: 当调用T为String类型时候,会默认调用下面的ServerResponse(int status, String msg)类型的构造器
+ this.status = status;
+ this.data = data;
+ }
+
+ private CommonResponse(int status, String msg, T data) {
+ this.status = status;
+ this.msg = msg;
+ this.data = data;
+ }
+
+ private CommonResponse(int status, String msg) {
+ this.status = status;
+ this.msg = msg;
+ }
+
+ /*
+ 对外开放调用的静态方法,用来调用私有构造器,来返回成功结果给前台
+ */
+
+ /**
+ * 返回成功码和默认的成功信息
+ */
+ public static CommonResponse createBySuccess() {
+ return new CommonResponse(ResponseCode.SUCCESS.getCode(),ResponseCode.SUCCESS.getDesc());
+ }
+
+ /**
+ * 返回成功码和成功信息
+ */
+ public static CommonResponse createBySuccessMessage(String msg) {
+ return new CommonResponse(ResponseCode.SUCCESS.getCode(), msg);
+ }
+
+ /**
+ * 返回成功码和数据
+ */
+ public static CommonResponse createBySuccess(T data) {
+ return new CommonResponse(ResponseCode.SUCCESS.getCode(), data);
+ }
+
+ /**
+ * 返回成功码和成功信息和数据
+ */
+ public static CommonResponse createBySuccess(String msg, T data) {
+ return new CommonResponse(ResponseCode.SUCCESS.getCode(), msg, data);
+ }
+
+ /*
+ 对外开放调用的静态方法,用来调用私有构造器,来返回失败结果给前台
+ */
+
+ /**
+ * 返回错误码和错误描述
+ */
+ public static CommonResponse createByError(){
+ return new CommonResponse(ResponseCode.ERROR.getCode(),ResponseCode.ERROR.getDesc());
+ }
+
+ /**
+ * 返回错误码和错误信息(传入)
+ */
+ public static CommonResponse createByErrorMessage(String errorMessage){
+ return new CommonResponse(ResponseCode.ERROR.getCode(),errorMessage);
+ }
+
+ /**
+ * 返回错误码(传入)和错误信息(传入)
+ */
+ public static CommonResponse createByErrorCodeMessage(int errorCode,String errorMessage){
+ return new CommonResponse(errorCode,errorMessage);
+ }
+}
diff --git a/ad-platform-common/src/main/java/com/baiye/http/ResponseCode.java b/ad-platform-common/src/main/java/com/baiye/http/ResponseCode.java
new file mode 100644
index 00000000..0e9d2c03
--- /dev/null
+++ b/ad-platform-common/src/main/java/com/baiye/http/ResponseCode.java
@@ -0,0 +1,54 @@
+package com.baiye.http;
+
+/**
+ * FileName: ResponseCode
+ * Date: 2019/12/11 20:30
+ * Description: 自定义Response响应返回体 -> 这边采用的是
+ * History:
+ *