Skip to content

Commit 9306a8c

Browse files
committed
增加钉钉接口
1 parent 2832d2f commit 9306a8c

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

SpringBootDemo/pom.xml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,38 @@
7979
<groupId>javax.servlet</groupId>
8080
<artifactId>javax.servlet-api</artifactId>
8181
</dependency>
82-
82+
83+
<dependency>
84+
<groupId>commons-codec</groupId>
85+
<artifactId>commons-codec</artifactId>
86+
<version>1.10</version>
87+
</dependency>
88+
89+
<dependency>
90+
<groupId>com.alibaba</groupId>
91+
<artifactId>fastjson</artifactId>
92+
<version>1.2.31</version>
93+
</dependency>
94+
95+
<dependency>
96+
<groupId>commons-io</groupId>
97+
<artifactId>commons-io</artifactId>
98+
<version>2.5</version>
99+
</dependency>
100+
101+
<dependency>
102+
<groupId>org.apache.httpcomponents</groupId>
103+
<artifactId>httpclient</artifactId>
104+
<version>4.5</version>
105+
</dependency>
106+
107+
<dependency>
108+
<groupId>org.apache.httpcomponents</groupId>
109+
<artifactId>httpmime</artifactId>
110+
<version>4.5</version>
111+
</dependency>
112+
113+
83114
</dependencies>
84115

85116
<properties>

SpringBootDemo/src/main/java/com/xiaour/spring/boot/controller/TestCtrl.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
package com.xiaour.spring.boot.controller;
22

3+
import java.util.HashMap;
4+
import java.util.Map;
5+
36
import org.springframework.beans.factory.annotation.Autowired;
47
import org.springframework.web.bind.annotation.PathVariable;
58
import org.springframework.web.bind.annotation.RequestMapping;
@@ -9,6 +12,7 @@
912
import com.xiaour.spring.boot.mapper.UserInfoMapper;
1013
import com.xiaour.spring.boot.utils.JsonUtil;
1114
import com.xiaour.spring.boot.utils.RedisUtil;
15+
import com.xiaour.spring.boot.utils.aes.AuthHelper;
1216

1317
/**
1418
* Created by xiaour on 2017/4/19.
@@ -71,4 +75,21 @@ public String get(@PathVariable("id")int id){
7175
}
7276
return "";
7377
}
78+
79+
/**
80+
* 获取数据库中的用户
81+
* @param id
82+
* @return
83+
*/
84+
@RequestMapping("/getAccessToken")
85+
public String getAccessToken(){
86+
try {
87+
Map<String,Object> data= new HashMap<>();
88+
data.put("access_token", AuthHelper.getAccessToken());
89+
return JsonUtil.getJsonString(data);
90+
} catch (Exception e) {
91+
e.printStackTrace();
92+
}
93+
return "";
94+
}
7495
}

SpringBootDemo/src/main/java/com/xiaour/spring/boot/filter/MyFilter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void init(FilterConfig filterConfig) throws ServletException {
4747
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
4848
HttpServletRequest request = (HttpServletRequest) servletRequest;
4949
HttpServletResponse response = (HttpServletResponse) servletResponse;
50-
50+
System.err.println(request.getParameter("code"));
5151
filterChain.doFilter(request, response);
5252
}
5353

0 commit comments

Comments
 (0)