Browse Source

first commit

xuzuoyun 5 years ago
commit
f36f0ac493

+ 2 - 0
.idea/.gitignore

@@ -0,0 +1,2 @@
+# Default ignored files
+/workspace.xml

+ 13 - 0
.idea/compiler.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="CompilerConfiguration">
+    <annotationProcessing>
+      <profile name="Maven default annotation processors profile" enabled="true">
+        <sourceOutputDir name="target/generated-sources/annotations" />
+        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
+        <outputRelativeToContentRoot value="true" />
+        <module name="callback" />
+      </profile>
+    </annotationProcessing>
+  </component>
+</project>

+ 7 - 0
.idea/encodings.xml

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding">
+    <file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
+    <file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
+  </component>
+</project>

+ 14 - 0
.idea/misc.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ExternalStorageConfigurationManager" enabled="true" />
+  <component name="MavenProjectsManager">
+    <option name="originalFiles">
+      <list>
+        <option value="$PROJECT_DIR$/pom.xml" />
+      </list>
+    </option>
+  </component>
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+    <output url="file://$PROJECT_DIR$/out" />
+  </component>
+</project>

+ 2 - 0
callback.iml

@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4" />

+ 87 - 0
pom.xml

@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>cn.com.ctop</groupId>
+    <artifactId>callback</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <properties>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+        <maven.compiler.encoding>UTF-8</maven.compiler.encoding>
+        <maven.compiler.source>1.7</maven.compiler.source>
+        <maven.compiler.target>1.7</maven.compiler.target>
+        <maven.test.skip>true</maven.test.skip>
+
+        <xxl-rpc.version>1.3.2</xxl-rpc.version>
+
+        <spring.version>4.3.22.RELEASE</spring.version>
+
+        <spring-boot.version>1.5.19.RELEASE</spring-boot.version>
+        <mybatis-spring-boot-starter.version>1.3.3</mybatis-spring-boot-starter.version>
+        <mysql-connector-java.version>5.1.47</mysql-connector-java.version>
+
+    </properties>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-starter-parent</artifactId>
+                <version>${spring-boot.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+
+    <dependencies>
+
+        <!-- starter-web:spring-webmvc + autoconfigure + logback + yaml + tomcat -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+        </dependency>
+        <!-- starter-test:junit + spring-test + mockito -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <!-- freemarker-starter -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-freemarker</artifactId>
+        </dependency>
+
+        <!-- xxl-mq-client -->
+        <dependency>
+            <groupId>com.xuxueli</groupId>
+            <artifactId>xxl-mq-client</artifactId>
+            <version>1.3.0-SNAPSHOT</version>
+        </dependency>
+
+    </dependencies>
+
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>${spring-boot.version}</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 11 - 0
src/main/java/cn/com/ctop/callback/MainApplication.java

@@ -0,0 +1,11 @@
+package cn.com.ctop.callback;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class MainApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(MainApplication.class, args);
+    }
+}

+ 29 - 0
src/main/java/cn/com/ctop/callback/conf/XxlMqConf.java

@@ -0,0 +1,29 @@
+package cn.com.ctop.callback.conf;
+
+import com.xxl.mq.client.factory.impl.XxlMqSpringClientFactory;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.stereotype.Component;
+
+@Component
+public class XxlMqConf {
+
+    // ---------------------- param ----------------------
+
+    @Value("${xxl.mq.admin.address}")
+    private String adminAddress;
+    @Value("${xxl.mq.accessToken}")
+    private String accessToken;
+
+
+    @Bean
+    public XxlMqSpringClientFactory getXxlMqConsumer(){
+
+        XxlMqSpringClientFactory xxlMqSpringClientFactory = new XxlMqSpringClientFactory();
+        xxlMqSpringClientFactory.setAdminAddress(adminAddress);
+        xxlMqSpringClientFactory.setAccessToken(accessToken);
+
+        return xxlMqSpringClientFactory;
+    }
+
+}

+ 29 - 0
src/main/java/cn/com/ctop/callback/controller/CallbackController.java

@@ -0,0 +1,29 @@
+package cn.com.ctop.callback.controller;
+
+import com.xxl.mq.client.message.XxlMqMessage;
+import com.xxl.mq.client.producer.XxlMqProducer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+@Controller
+public class CallbackController {
+    private Logger logger = LoggerFactory.getLogger(CallbackController.class);
+    @ExceptionHandler({Exception.class})
+    public String exception(Exception e) {
+        e.printStackTrace();
+        return e.getMessage();
+    }
+    @RequestMapping("/callback")
+    @ResponseBody
+    public String callback(){
+        String topic = "bytedance_auth";
+        String data = "时间戳:" + System.currentTimeMillis();
+        logger.info(data);
+        XxlMqProducer.produce(new XxlMqMessage(topic, data));
+        return "SUCCESS";
+    }
+}

+ 12 - 0
src/main/resources/application.properties

@@ -0,0 +1,12 @@
+### web
+server.port=8081
+server.context-path=/
+
+### resources
+spring.mvc.static-path-pattern=/static/**
+spring.resources.static-locations=classpath:/static/
+
+# xxl-mq, admin conf
+xxl.mq.admin.address=http://localhost:8080/xxl-mq-admin
+### xxl-mq, access token
+xxl.mq.accessToken=

BIN
target/callback-1.0-SNAPSHOT.jar


BIN
target/callback-1.0-SNAPSHOT.jar.original


+ 12 - 0
target/classes/application.properties

@@ -0,0 +1,12 @@
+### web
+server.port=8081
+server.context-path=/
+
+### resources
+spring.mvc.static-path-pattern=/static/**
+spring.resources.static-locations=classpath:/static/
+
+# xxl-mq, admin conf
+xxl.mq.admin.address=http://localhost:8080/xxl-mq-admin
+### xxl-mq, access token
+xxl.mq.accessToken=

BIN
target/classes/cn/com/ctop/callback/MainApplication.class


BIN
target/classes/cn/com/ctop/callback/conf/XxlMqConf.class


BIN
target/classes/cn/com/ctop/callback/controller/CallbackController.class


+ 5 - 0
target/maven-archiver/pom.properties

@@ -0,0 +1,5 @@
+#Generated by Maven
+#Mon Apr 27 14:04:41 CST 2020
+version=1.0-SNAPSHOT
+groupId=cn.com.ctop
+artifactId=callback

+ 3 - 0
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst

@@ -0,0 +1,3 @@
+cn\com\ctop\callback\conf\XxlMqConf.class
+cn\com\ctop\callback\MainApplication.class
+cn\com\ctop\callback\controller\CallbackController.class

+ 2 - 0
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst

@@ -0,0 +1,2 @@
+D:\IdeaProjects\callback\src\main\java\cn\com\ctop\callback\conf\XxlMqConf.java
+D:\IdeaProjects\callback\src\main\java\cn\com\ctop\callback\controller\CallbackController.java