Skip to content

Commit f8aeda2

Browse files
author
xinzhifu
committed
webhook测试提交
1 parent 82eda5a commit f8aeda2

File tree

6 files changed

+198
-55
lines changed

6 files changed

+198
-55
lines changed

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
HELP.md
2+
target/
3+
!.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**/target/
5+
!**/src/test/**/target/
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
16+
### IntelliJ IDEA ###
17+
.idea
18+
*.iws
19+
*.iml
20+
*.ipr
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
build/
29+
!**/src/main/**/build/
30+
!**/src/test/**/build/
31+
32+
### VS Code ###
33+
.vscode/
34+
!/.idea/
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
HELP.md
2+
target/
3+
!.mvn/wrapper/maven-wrapper.jar
4+
!**/src/main/**/target/
5+
!**/src/test/**/target/
6+
7+
### STS ###
8+
.apt_generated
9+
.classpath
10+
.factorypath
11+
.project
12+
.settings
13+
.springBeans
14+
.sts4-cache
15+
16+
### IntelliJ IDEA ###
17+
.idea
18+
*.iws
19+
*.iml
20+
*.ipr
21+
22+
### NetBeans ###
23+
/nbproject/private/
24+
/nbbuild/
25+
/dist/
26+
/nbdist/
27+
/.nb-gradle/
28+
build/
29+
!**/src/main/**/build/
30+
!**/src/test/**/build/
31+
32+
### VS Code ###
33+
.vscode/
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3+
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
4+
<output url="file://$MODULE_DIR$/target/classes" />
5+
<output-test url="file://$MODULE_DIR$/target/test-classes" />
6+
<content url="file://$MODULE_DIR$">
7+
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8+
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9+
<excludeFolder url="file://$MODULE_DIR$/target" />
10+
</content>
11+
<orderEntry type="inheritedJdk" />
12+
<orderEntry type="sourceFolder" forTests="false" />
13+
<orderEntry type="library" name="Maven: com.dtflys.forest:spring-boot-starter-forest:1.5.0-RC3" level="project" />
14+
<orderEntry type="library" name="Maven: com.dtflys.forest:forest-core:1.5.0-RC3" level="project" />
15+
<orderEntry type="library" name="Maven: com.googlecode.juniversalchardet:juniversalchardet:1.0.3" level="project" />
16+
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient-cache:4.5.6" level="project" />
17+
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.4.10" level="project" />
18+
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore-nio:4.4.10" level="project" />
19+
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpasyncclient:4.1.4" level="project" />
20+
<orderEntry type="library" name="Maven: com.squareup.okhttp3:okhttp:3.14.9" level="project" />
21+
<orderEntry type="library" name="Maven: com.squareup.okio:okio:1.17.2" level="project" />
22+
<orderEntry type="library" name="Maven: com.google.code.findbugs:jsr305:3.0.1" level="project" />
23+
<orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
24+
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1" level="project" />
25+
<orderEntry type="library" name="Maven: log4j:log4j:1.2.12" level="project" />
26+
<orderEntry type="library" name="Maven: logkit:logkit:1.0.1" level="project" />
27+
<orderEntry type="library" name="Maven: avalon-framework:avalon-framework:4.1.3" level="project" />
28+
<orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.25" level="project" />
29+
<orderEntry type="library" name="Maven: com.dtflys.forest:forest-spring:1.5.0-RC3" level="project" />
30+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-configuration-processor:2.0.5.RELEASE" level="project" />
31+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.6" level="project" />
32+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.6" level="project" />
33+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.core:jackson-annotations:2.9.0" level="project" />
34+
<orderEntry type="library" name="Maven: com.aventstack:extentreports:3.0.6" level="project" />
35+
<orderEntry type="library" name="Maven: org.freemarker:freemarker:2.3.28" level="project" />
36+
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver:3.6.4" level="project" />
37+
<orderEntry type="library" name="Maven: org.mongodb:bson:3.6.4" level="project" />
38+
<orderEntry type="library" name="Maven: org.mongodb:mongodb-driver-core:3.6.4" level="project" />
39+
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.6" level="project" />
40+
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
41+
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.6" level="project" />
42+
<orderEntry type="library" name="Maven: org.jsoup:jsoup:1.9.2" level="project" />
43+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-thymeleaf:2.0.5.RELEASE" level="project" />
44+
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf-spring5:3.0.9.RELEASE" level="project" />
45+
<orderEntry type="library" name="Maven: org.thymeleaf:thymeleaf:3.0.9.RELEASE" level="project" />
46+
<orderEntry type="library" name="Maven: org.attoparser:attoparser:2.0.4.RELEASE" level="project" />
47+
<orderEntry type="library" name="Maven: org.unbescape:unbescape:1.1.5.RELEASE" level="project" />
48+
<orderEntry type="library" name="Maven: org.thymeleaf.extras:thymeleaf-extras-java8time:3.0.1.RELEASE" level="project" />
49+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:2.0.5.RELEASE" level="project" />
50+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:2.0.5.RELEASE" level="project" />
51+
<orderEntry type="library" name="Maven: org.springframework:spring-context:5.0.9.RELEASE" level="project" />
52+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:2.0.5.RELEASE" level="project" />
53+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-logging:2.0.5.RELEASE" level="project" />
54+
<orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.2.3" level="project" />
55+
<orderEntry type="library" name="Maven: ch.qos.logback:logback-core:1.2.3" level="project" />
56+
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-to-slf4j:2.10.0" level="project" />
57+
<orderEntry type="library" name="Maven: org.apache.logging.log4j:log4j-api:2.10.0" level="project" />
58+
<orderEntry type="library" name="Maven: org.slf4j:jul-to-slf4j:1.7.25" level="project" />
59+
<orderEntry type="library" name="Maven: javax.annotation:javax.annotation-api:1.3.2" level="project" />
60+
<orderEntry type="library" name="Maven: org.springframework:spring-core:5.0.9.RELEASE" level="project" />
61+
<orderEntry type="library" name="Maven: org.springframework:spring-jcl:5.0.9.RELEASE" level="project" />
62+
<orderEntry type="library" scope="RUNTIME" name="Maven: org.yaml:snakeyaml:1.19" level="project" />
63+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-web:2.0.5.RELEASE" level="project" />
64+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-json:2.0.5.RELEASE" level="project" />
65+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.6" level="project" />
66+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.6" level="project" />
67+
<orderEntry type="library" name="Maven: com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.6" level="project" />
68+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-tomcat:2.0.5.RELEASE" level="project" />
69+
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.34" level="project" />
70+
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-el:8.5.34" level="project" />
71+
<orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-websocket:8.5.34" level="project" />
72+
<orderEntry type="library" name="Maven: org.hibernate.validator:hibernate-validator:6.0.12.Final" level="project" />
73+
<orderEntry type="library" name="Maven: javax.validation:validation-api:2.0.1.Final" level="project" />
74+
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.2.Final" level="project" />
75+
<orderEntry type="library" name="Maven: com.fasterxml:classmate:1.3.4" level="project" />
76+
<orderEntry type="library" name="Maven: org.springframework:spring-web:5.0.9.RELEASE" level="project" />
77+
<orderEntry type="library" name="Maven: org.springframework:spring-beans:5.0.9.RELEASE" level="project" />
78+
<orderEntry type="library" name="Maven: org.springframework:spring-webmvc:5.0.9.RELEASE" level="project" />
79+
<orderEntry type="library" name="Maven: org.springframework:spring-aop:5.0.9.RELEASE" level="project" />
80+
<orderEntry type="library" name="Maven: org.springframework:spring-expression:5.0.9.RELEASE" level="project" />
81+
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-starter-test:2.0.5.RELEASE" level="project" />
82+
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test:2.0.5.RELEASE" level="project" />
83+
<orderEntry type="library" scope="TEST" name="Maven: org.springframework.boot:spring-boot-test-autoconfigure:2.0.5.RELEASE" level="project" />
84+
<orderEntry type="library" scope="TEST" name="Maven: com.jayway.jsonpath:json-path:2.4.0" level="project" />
85+
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:json-smart:2.3" level="project" />
86+
<orderEntry type="library" scope="TEST" name="Maven: net.minidev:accessors-smart:1.2" level="project" />
87+
<orderEntry type="library" scope="TEST" name="Maven: org.ow2.asm:asm:5.0.4" level="project" />
88+
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
89+
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:3.9.1" level="project" />
90+
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:2.15.0" level="project" />
91+
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy:1.7.11" level="project" />
92+
<orderEntry type="library" scope="TEST" name="Maven: net.bytebuddy:byte-buddy-agent:1.7.11" level="project" />
93+
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.6" level="project" />
94+
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
95+
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-library:1.3" level="project" />
96+
<orderEntry type="library" scope="TEST" name="Maven: org.skyscreamer:jsonassert:1.5.0" level="project" />
97+
<orderEntry type="library" scope="TEST" name="Maven: com.vaadin.external.google:android-json:0.0.20131108.vaadin1" level="project" />
98+
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.0.9.RELEASE" level="project" />
99+
<orderEntry type="library" scope="TEST" name="Maven: org.xmlunit:xmlunit-core:2.5.1" level="project" />
100+
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.7" level="project" />
101+
<orderEntry type="library" scope="PROVIDED" name="Maven: org.projectlombok:lombok:1.16.18" level="project" />
102+
<orderEntry type="library" name="Maven: com.alibaba:fastjson:1.2.49" level="project" />
103+
<orderEntry type="library" scope="RUNTIME" name="Maven: mysql:mysql-connector-java:5.1.47" level="project" />
104+
<orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-amqp:2.0.5.RELEASE" level="project" />
105+
<orderEntry type="library" name="Maven: org.springframework:spring-messaging:5.0.9.RELEASE" level="project" />
106+
<orderEntry type="library" name="Maven: org.springframework.amqp:spring-rabbit:2.0.6.RELEASE" level="project" />
107+
<orderEntry type="library" name="Maven: org.springframework.amqp:spring-amqp:2.0.6.RELEASE" level="project" />
108+
<orderEntry type="library" name="Maven: org.springframework.retry:spring-retry:1.2.2.RELEASE" level="project" />
109+
<orderEntry type="library" name="Maven: com.rabbitmq:amqp-client:5.4.1" level="project" />
110+
<orderEntry type="library" name="Maven: org.springframework:spring-tx:5.0.9.RELEASE" level="project" />
111+
</component>
112+
</module>

springboot-webhook-wexin/src/main/java/com/xiaofu/webhook/controller/WebhookController.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import org.springframework.web.bind.annotation.RequestMapping;
1313
import org.springframework.web.bind.annotation.RestController;
1414

15+
import java.util.ArrayList;
16+
1517
@Slf4j
1618
@RestController
1719
public class WebhookController {
@@ -28,7 +30,7 @@ public class WebhookController {
2830
@PostMapping("/webhook")
2931
public String webhookGithub(@RequestBody GithubWebhookPullVo webhook) {
3032

31-
33+
log.info("GithubWebhookPullVo {}", JSON.toJSONString(webhook));
3234
/**
3335
* {
3436
* "msgtype": "text",
@@ -41,12 +43,19 @@ public String webhookGithub(@RequestBody GithubWebhookPullVo webhook) {
4143
*/
4244

4345
WeChatWebhook weChatWebhook = new WeChatWebhook();
46+
weChatWebhook.setMsgtype("text");
47+
WeChatWebhook.TextDTO textDTO = new WeChatWebhook.TextDTO();
48+
textDTO.setContent(webhook.getRepository().getFull_name());
49+
textDTO.setMentionedList(new ArrayList<>());
50+
textDTO.setMentionedMobileList(new ArrayList<>());
51+
weChatWebhook.setText(textDTO);
4452

4553
/**
4654
* 组装参数后向企业微信发送webhook请求
4755
*/
56+
log.info("企业微信发送 weChatWebhook {}", JSON.toJSONString(weChatWebhook));
4857
ForestResponse<String> attributeBatch = attributeClient.getAttributeBatch(weChatWebhook);
49-
50-
return JSON.toJSONString(webhook);
58+
log.info("企业微信发送 weChatWebhook {}", JSON.toJSONString(weChatWebhook));
59+
return JSON.toJSONString(attributeBatch);
5160
}
5261
}

springboot-webhook-wexin/src/main/java/com/xiaofu/webhook/vo/GithubWebhookPullVo.java

Lines changed: 6 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public class GithubWebhookPullVo {
2828
private SenderBean sender;
2929

3030

31+
@Data
3132
public static class HookBean {
3233
/**
3334
* type : Repository
@@ -58,6 +59,7 @@ public static class HookBean {
5859
private List<String> events;
5960

6061

62+
@Data
6163
public static class ConfigBean {
6264
/**
6365
* content_type : json
@@ -68,32 +70,9 @@ public static class ConfigBean {
6870
private String content_type;
6971
private String insecure_ssl;
7072
private String url;
71-
72-
public String getContent_type() {
73-
return content_type;
74-
}
75-
76-
public void setContent_type(String content_type) {
77-
this.content_type = content_type;
78-
}
79-
80-
public String getInsecure_ssl() {
81-
return insecure_ssl;
82-
}
83-
84-
public void setInsecure_ssl(String insecure_ssl) {
85-
this.insecure_ssl = insecure_ssl;
86-
}
87-
88-
public String getUrl() {
89-
return url;
90-
}
91-
92-
public void setUrl(String url) {
93-
this.url = url;
94-
}
9573
}
9674

75+
@Data
9776
public static class LastResponseBean {
9877
/**
9978
* code : null
@@ -105,32 +84,10 @@ public static class LastResponseBean {
10584
private String status;
10685
private Object message;
10786

108-
public Object getCode() {
109-
return code;
110-
}
111-
112-
public void setCode(Object code) {
113-
this.code = code;
114-
}
115-
116-
public String getStatus() {
117-
return status;
118-
}
119-
120-
public void setStatus(String status) {
121-
this.status = status;
122-
}
123-
124-
public Object getMessage() {
125-
return message;
126-
}
127-
128-
public void setMessage(Object message) {
129-
this.message = message;
130-
}
13187
}
13288
}
13389

90+
@Data
13491
public static class RepositoryBean {
13592
/**
13693
* id : 275712523
@@ -284,6 +241,7 @@ public static class RepositoryBean {
284241
private String default_branch;
285242

286243

244+
@Data
287245
public static class OwnerBean {
288246
/**
289247
* login : chengxy-nds
@@ -329,6 +287,7 @@ public static class OwnerBean {
329287
}
330288
}
331289

290+
@Data
332291
public static class SenderBean {
333292
/**
334293
* login : chengxy-nds
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
#server.port = 8888
2-
3-
4-
forest.variables.weixin_base_url = http://baidu.com
5-
export JAVA_HOME=/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
1+
server.port = 8888

0 commit comments

Comments
 (0)