diff --git a/pom.xml b/pom.xml
index 0e25882..a0668ae 100644
--- a/pom.xml
+++ b/pom.xml
@@ -42,6 +42,11 @@
lombok
+
+ org.apache.commons
+ commons-lang3
+
+
cn.hutool
hutool-all
diff --git a/src/main/java/com/baiyee/adcallback/api/controller/GenerateController.java b/src/main/java/com/baiyee/adcallback/api/controller/GenerateController.java
new file mode 100644
index 0000000..55b76e9
--- /dev/null
+++ b/src/main/java/com/baiyee/adcallback/api/controller/GenerateController.java
@@ -0,0 +1,33 @@
+package com.baiyee.adcallback.api.controller;
+
+import com.baiyee.adcallback.api.common.CommonResponse;
+import com.baiyee.adcallback.service.GenerateService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+@RestController
+@RequestMapping("/generate")
+public class GenerateController {
+
+ @Resource
+ private GenerateService generateService;
+
+ /**
+ * 生成DMP链接
+ * @param tag
+ * @return
+ */
+ @GetMapping("/dmp")
+ public CommonResponse generateDmp(@RequestParam("tag") String tag,@RequestParam("type") Integer type){
+ String dmp = generateService.generateDmp(tag, type);
+ if (dmp == null || StringUtils.isBlank(dmp)){
+ return CommonResponse.createByErrorMessage("暂不支持此类型");
+ }
+ return CommonResponse.createBySuccess(dmp);
+ }
+}
diff --git a/src/main/java/com/baiyee/adcallback/common/exception/BadRequestException.java b/src/main/java/com/baiyee/adcallback/common/exception/BadRequestException.java
new file mode 100644
index 0000000..a6ed247
--- /dev/null
+++ b/src/main/java/com/baiyee/adcallback/common/exception/BadRequestException.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2019-2020 Zheng Jie
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.baiyee.adcallback.common.exception;
+
+import lombok.Getter;
+import org.springframework.http.HttpStatus;
+
+import static org.springframework.http.HttpStatus.BAD_REQUEST;
+
+/**
+ * @author Zheng Jie
+ * @date 2018-11-23
+ * 统一异常处理
+ */
+@Getter
+public class BadRequestException extends RuntimeException{
+
+ private Integer status = BAD_REQUEST.value();
+
+ public BadRequestException(String msg){
+ super(msg);
+ }
+
+ public BadRequestException(HttpStatus status, String msg){
+ super(msg);
+ this.status = status.value();
+ }
+}
diff --git a/src/main/java/com/baiyee/adcallback/service/GenerateService.java b/src/main/java/com/baiyee/adcallback/service/GenerateService.java
new file mode 100644
index 0000000..6dc8f69
--- /dev/null
+++ b/src/main/java/com/baiyee/adcallback/service/GenerateService.java
@@ -0,0 +1,12 @@
+package com.baiyee.adcallback.service;
+
+
+public interface GenerateService {
+
+ /**
+ * 生成DMP链接
+ * @param tag
+ * @return
+ */
+ String generateDmp(String tag, Integer type);
+}
diff --git a/src/main/java/com/baiyee/adcallback/service/impl/GenerateServiceImpl.java b/src/main/java/com/baiyee/adcallback/service/impl/GenerateServiceImpl.java
new file mode 100644
index 0000000..6b82b6f
--- /dev/null
+++ b/src/main/java/com/baiyee/adcallback/service/impl/GenerateServiceImpl.java
@@ -0,0 +1,40 @@
+package com.baiyee.adcallback.service.impl;
+
+import com.baiyee.adcallback.common.exception.BadRequestException;
+import com.baiyee.adcallback.service.GenerateService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+@Service
+@Slf4j
+public class GenerateServiceImpl implements GenerateService {
+
+ @Value("${generate.url}")
+ private String URL;
+
+ /**
+ *
+ * @param tag
+ * @param type 0:巨量 1:百度 2:快手 3:UC 4:VIVO
+ * @return
+ */
+ @Override
+ public String generateDmp(String tag, Integer type) {
+ String replaceTag = tag.replace(" ", "");
+ String JL = "/api/jl/monitor?aid=__AID__&cid=__CID__&ctype=__CTYPE__&csite=__CSITE__&imei=__IMEI__&idfa=__IDFA__&oaid=__OAID__&os=__OS__&mac=__MAC__&mac1=__MAC1__&ip=__IP__&geo=__GEO__&TIMESTAMP=__TS__&callback_url=__CALLBACK_URL__&model=__MODEL__&caid1=__CAID1__&tag=";
+ String BD = "/api/bd/monitor?userid=__USER_ID__&aid=__IDEA_ID__&pid=__PLAN_ID__&uid=__UNIT_ID__&callback_url=__CALLBACK_URL__&click_id=__CLICK_ID__&idfa=__IDFA__&imei_md5=__IMEI__&oaid=__OAID__&mac=__MAC__&ip=__IP__&os=__OS__&ts=__TS__&device_info=__DEVICE_INFO__&tag=";
+ String generateDmp;
+ switch (type){
+ case 0:
+ generateDmp = URL + JL + replaceTag;
+ break;
+ case 1:
+ generateDmp = URL + BD +replaceTag;
+ break;
+ default:
+ generateDmp = null;
+ }
+ return generateDmp;
+ }
+}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 810a67d..0014780 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -52,4 +52,7 @@ short:
corePoolSize: 4
maxPoolSize: 32
queueCapacity: 100
- ThreadNamePrefix: 'XXX-'
\ No newline at end of file
+ ThreadNamePrefix: 'XXX-'
+
+generate:
+ url: https://cb.tuoz.net
\ No newline at end of file